Adds openapi snippets using openapi-snippet
module in redoc style (x-codeSamples). This is a CLI wrapper on openapi-snippet
To install:
$ npm install -g openapi-snippet-cli
$ openapi-snippet schema.yaml -o dist/schema.yaml
The example above should add snippets to schema.yaml
and output the modified schema to a new file dist/schema.yaml
.
$ openapi-snippet schema.yaml -e json -o dist/schema.json
$ openapi-snippet schema.yaml -t java -t c -o dist/schema.json
The example above should add snippets for java
and c
using their default frameworks
$ openapi-snippet schema.yaml -t java_okhttp -o dist/schema.json
This should add snippets for 'java` using OkHttp.
USAGE
$ openapi-snippet [FILE]
ARGUMENTS
FILE input openapi document. It will attempt to resolve references (including both internal adn external ones)
OPTIONS
-e, --ext=yaml|json [default: yaml] output format
-h, --help show CLI help
-o, --output=output [default: output.yaml] output file name
-t, --targets=targets target snippet languages + frameworks. Can be provided multiple times. If inputting language only, defaults to one of the frameworks. Supports
languages supported in https://github.com/ErikWittern/openapi-snippet. Defaults to adding snippets for ALL supported languages.
-v, --version show CLI version