Skip to main content

api generate:oas

Exports an OpenAPI 3.0.1 specification. This allows you to generate an OpenAPI specification for use in other software, such as third-party documentation generation software. Both --json and --yaml flags are supported to determine the output format. By default, a .yaml file is created.

api scripts

The scripts command will export an OpenAPI specification and allow you to run a command or script to process that specification. It can even manage dependencies! generate:oas is great for a one-time run, for workflow integration we recommend scripts.

Flags & Options#

There are two optional flags that determine which formats will be exported. You may use both flags if you need both formats:

  • --json
  • --yaml

Examples#

Export an OpenAPI 3.0.1 specification#

api generate:oas
[optic] Generated OAS files[optic] {...}/todo-js/.optic/generated/openapi.yaml

Export an OpenAPI 3.0.1 specification in JSON format#

api generate:oas --json
[optic] Generated OAS files[optic] {...}/todo-js/.optic/generated/openapi.json

Issues & Contributing#

Having trouble? Open an issue on GitHub

Have an idea for changing this command? Here's where it lives in the repo. PRs welcome!

Need help or want to talk with us about a use case? Join Contributing on Discord