项目作者: Th3Mouk

项目描述 :
PHP library which provide a scaffolding and generate an OpenAPI file :books: :gear:
高级语言: PHP
项目地址: git://github.com/Th3Mouk/OpenAPIGenerator.git
创建时间: 2018-09-26T11:13:38Z
项目社区:https://github.com/Th3Mouk/OpenAPIGenerator

开源协议:MIT License

下载


Open API Generator

This PHP library allows you to cut and organize your HUGE openapi.yml file, into small slices.

Versioning and deploy your OpenAPI documentation become easier.

Latest Stable Version
Latest Unstable Version
Total Downloads
License

Build Status
Scrutinizer Code Quality

Installation

composer require th3mouk/openapi-generator

Usage

Inside your project you can now run additional commands:

  • vendor/bin/openapi scaffold
  • vendor/bin/openapi generate

Scaffold

To prepare your project, run the first command scaffold.

It will create new folders.

  1. specs
  2. ├── components
  3. ├── schemas
  4. ├── responses
  5. ├── parameters
  6. ├── examples
  7. ├── requestBodies
  8. ├── headers
  9. ├── securitySchemes
  10. ├── links
  11. └── callbacks
  12. └── paths

Add your schema

I personnaly use Swagger OpenAPI specifications to write my schema.

One example of organization can be :

  1. specs
  2. ├── components
  3. └── paths
  4. ├── authentication
  5. ├── login.yaml
  6. └── register.yaml
  7. └── unicorn
  8. ├── list.yaml
  9. └── detail.yaml

Generate

The command vendor/bin/openapi generate take arguments and options to generate the openapi.yml file.

You can add a path like this vendor/bin/openapi generate /in-this-folder/sub

And it exists a --pretty-json or -p option to obtain a human readable file.

Please

Feel free to improve this library.