    !npm type definitions 
openapicmd - The CLI for all things OpenAPI and Swagger
Install
`` npm install -g openapicmd openapi help `
Features
- [x] Read and convert local and remote JSON/YAML OpenAPI definition files - [x] Generate TypeScript types from OpenAPI definitions - [x] Use as a CLI client to easily call API endpoints - [x] Run Local Mock APIs - [x] Automate API tests and validate specs - [x] Run Swagger UI or ReDoc locally - [x] Bundle static Swagger UI or ReDoc sites - [x] Run Swagger Editor locally - [x] Convert Swagger to OpenAPI
FLAGS -B, --bundle resolve remote $ref pointers -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -D, --dereference resolve $ref pointers -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -P, --password= set basic auth password -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --[no-]remove-unreferenced Remove unreferenced components, you can skip individual component being removed by setting x-openapicmd-keep to true -V, --validate validate against openapi schema -h, --help Show CLI help. -k, --apikey= set api key -s, --security=... use security scheme -t, --token= set bearer token -u, --username= set basic auth username
DESCRIPTION Authenticate with apis (writes to .openapiconfig)
FLAGS -B, --bundle resolve remote $ref pointers -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -D, --dereference resolve $ref pointers -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -P, --password= set basic auth password -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --[no-]remove-unreferenced Remove unreferenced components, you can skip individual component being removed by setting x-openapicmd-keep to true -V, --validate validate against openapi schema -d, --data= request body -h, --help Show CLI help. -i, --include include status code and response headers the output -k, --apikey= set api key -o, --operation=operationId operationId -p, --param=key=value... parameter -s, --security=... use security scheme -t, --token= set bearer token -u, --username= set basic auth username -v, --verbose verbose mode --[no-]interactive [default: true] enable CLI interactive mode
FLAGS -B, --bundle resolve remote $ref pointers -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -D, --dereference resolve $ref pointers -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --[no-]remove-unreferenced Remove unreferenced components, you can skip individual component being removed by setting x-openapicmd-keep to true -V, --validate validate against openapi schema -h, --help Show CLI help. --operations list operations in document --schemas list schemas in document --security list security schemes in document
DESCRIPTION Display API information
EXAMPLES $ openapi info https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml
FLAGS -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -S, --server=http://localhost:9000... override servers definition -T, --title= [default: My API] The title for the API -d, --description= Description for the API -f, --format=
DESCRIPTION Initialise a definition file from scratch
FLAGS -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --swagger-ui=docs Swagger UI endpoint -h, --help Show CLI help. -p, --port=9000 [default: 9000] port --[no-]logger [default: true] log requests --[no-]validate [default: true] validate requests according to schema
FLAGS -B, --bundle resolve remote $ref pointers -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -D, --dereference resolve $ref pointers -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --[no-]remove-unreferenced Remove unreferenced components, you can skip individual component being removed by setting x-openapicmd-keep to true -V, --validate validate against openapi schema -f, --format=
[default: yaml] output format -h, --help Show CLI help. --json format as json (short for -f json) --yaml format as yaml (short for -f yaml)
FLAGS -B, --bundle=outDir bundle a static site to directory -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -h, --help Show CLI help. -p, --port=9000 [default: 9000] port --[no-]logger [default: true] log requests
FLAGS -B, --bundle=outDir bundle a static site to directory -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -h, --help Show CLI help. -p, --port=9000 [default: 9000] port --[no-]deeplinks [default: true] allow deep linking --expand=
[default: list] default expansion setting for the operations and tags --[no-]filter [default: true] enable filtering by tag --[no-]logger [default: true] log requests --[no-]operationids [default: true] display operationIds --proxy set up a proxy for the api to avoid CORS issues --[no-]requestduration [default: true] display request durations in "try it now" --[no-]withcredentials [default: true] send cookies in "try it now"
FLAGS -B, --bundle resolve remote $ref pointers -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -D, --dereference resolve $ref pointers -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --[no-]remove-unreferenced Remove unreferenced components, you can skip individual component being removed by setting x-openapicmd-keep to true -V, --validate validate against openapi schema -f, --format=
[default: yaml] output format -h, --help Show CLI help. --json format as json (short for -f json) --yaml format as yaml (short for -f yaml)
DESCRIPTION Convert Swagger 2.0 definitions to OpenAPI 3.0.x
FLAGS -B, --bundle resolve remote $ref pointers -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -D, --dereference resolve $ref pointers -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -P, --password= set basic auth password -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --[no-]remove-unreferenced Remove unreferenced components, you can skip individual component being removed by setting x-openapicmd-keep to true -V, --validate validate against openapi schema -h, --help Show CLI help. -k, --apikey= set api key -o, --operation=operationId... filter by operationId -s, --security=... use security scheme -t, --token= set bearer token -u, --username= set basic auth username -v, --verbose verbose mode --[no-]interactive [default: true] enable CLI interactive mode
FLAGS -B, --bundle resolve remote $ref pointers -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -D, --dereference resolve $ref pointers -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -P, --password= set basic auth password -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --[no-]remove-unreferenced Remove unreferenced components, you can skip individual component being removed by setting x-openapicmd-keep to true -V, --validate validate against openapi schema -c, --checks=2XXStatus... checks to include in test -d, --data= request body -h, --help Show CLI help. -k, --apikey= set api key -n, --name=my test test name -o, --operation=operationId operationId -p, --param=key=value... parameter -s, --security=... use security scheme -t, --token= set bearer token -u, --username= set basic auth username -v, --verbose verbose mode --auto auto generate tests for all operations --[no-]interactive [default: true] enable CLI interactive mode
DESCRIPTION Add automated tests for API operations
FLAGS -A, --[no-]type-aliases Generate module level type aliases for schema components defined in spec -B, --bundle resolve remote $ref pointers -C, --strip=default|all|openapi_client_axios|openapi_backend Strip optional metadata such as examples and descriptions from definition -D, --dereference resolve $ref pointers -E, --exclude-ext=x-internal Specify an openapi extension to exclude parts of the spec -H, --header=... add request headers when calling remote urls -I, --inject={"info":{"version":"1.0.0"}}... inject JSON to definition with deep merge -R, --root=/ override API root path -S, --server=http://localhost:9000... override servers definition -U, --[no-]remove-unreferenced Remove unreferenced components, you can skip individual component being removed by setting x-openapicmd-keep to true -V, --validate validate against openapi schema -b, --banner= include a banner comment at the top of the generated file -h, --help Show CLI help. --backend Generate types for openapi-backend --client Generate types for openapi-client-axios (default)
DESCRIPTION Generate types from openapi definition