Skip to content

PHP library which provide a scaffolding and generate an OpenAPI file 📚 ⚙️

License

Notifications You must be signed in to change notification settings

Th3Mouk/OpenAPIGenerator

Repository files navigation

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.

specs
├── components
│   ├── schemas
│   ├── responses
│   ├── parameters
│   ├── examples
│   ├── requestBodies
│   ├── headers
│   ├── securitySchemes
│   ├── links
│   └── callbacks
└── paths

Add your schema

I personnaly use Swagger OpenAPI specifications to write my schema.

One example of organization can be :

specs
├── components
└── paths
    ├── authentication
    │   ├── login.yaml
    │   └── register.yaml
    └── unicorn
        ├── list.yaml
        └── 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.