Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danijelakraljevic/schema_generator
Json schema and swagger docs generator
https://github.com/danijelakraljevic/schema_generator
api database documentation generator json-schema oas oas3 php swagger
Last synced: about 1 month ago
JSON representation
Json schema and swagger docs generator
- Host: GitHub
- URL: https://github.com/danijelakraljevic/schema_generator
- Owner: DanijelaKraljevic
- License: other
- Created: 2020-02-13T20:24:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-31T02:27:23.000Z (almost 2 years ago)
- Last Synced: 2024-10-21T05:32:33.683Z (2 months ago)
- Topics: api, database, documentation, generator, json-schema, oas, oas3, php, swagger
- Language: PHP
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Json schema generator
Application contains several console commands which generate [json schema](https://json-schema.org/) and open API ( [OAS 3](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md) ) docs.
CONFIGURATION
-------------[PHP](http://php.net/downloads.php) (> 5.4.0) and [Composer](https://getcomposer.org/) are required to have.
From base directory, using CLI call command
```shell
composer update
```### Base
Edit file `config/db.php` with real data for db connection:
```php
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=test',
'username' => 'root',
'password' => '1234',
'charset' => 'utf8',
];
```**NOTE:**
- App will not create database, it should exist beforehand.### Modul
Edit file `config/console.php` if the default configuration is not appliable:
```php
$config['modules']['generator'] = [
'class' => 'app\modules\ConsoleModule',// Properties can be changed here
//'allowedIPs' => ['127.0.0.1', '::1'],
//'newFileMode' => '0666';
//'newDirMode' => '0777';
//'newFileMode' => '0666'; ];
];
```**NOTE:**
-Change only commented properties, not the class.### HOW TO USE
-------------Call console commands with `php yii` from base directory of project.
```shell
~/www/schema-generator$ php yii generator/jsonschema --tableName=test --modelClass=Test --httpMethod=Post
```**generator/jsonschema:**
* --tableName : correct name of database table
* --modelClass : name which will be used to generate name of the file
* --httpMethod: http method to generate the json schema for**generator/swagger:**
* --tableName : correct name of database table
* --tableNamePlural : correct name of database tableFiles will be generated in appropriate directories in /commands/generated directory.