openapicmd
Command line tools for openapi-enabled APIs
Last updated a month ago by anttiviljami .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install openapicmd 
SYNC missed versions from official npm registry.

OpenAPICMD

Build Status Dependencies npm version License Sponsored

Command line tools for openapi-enabled APIs

Features

  • [x] Read and convert local and remote JSON/YAML OpenAPI definition files
  • [x] Run Swagger UI locally
  • [x] Bundle static Swagger UI sites
  • [x] Run Swagger Editor locally
  • [x] Convert Swagger 2.0 to OpenAPI 3.0.x
  • [x] Run Mock APIs
  • [ ] Use as CLI client to call API operations

Usage

$ npm install -g openapicmd
$ openapi COMMAND
running command...
$ openapi (-v|--version|version)
openapicmd/0.1.6 darwin-x64 node-v10.12.0
$ openapi --help [COMMAND]
USAGE
  $ openapi COMMAND
...

Commands

openapi help [COMMAND]

display help for openapi

USAGE
  $ openapi help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

openapi info [DEFINITION]

print information about definition file

USAGE
  $ openapi info [DEFINITION]

ARGUMENTS
  DEFINITION  input definition file

OPTIONS
  -h, --help         show CLI help
  --[no-]operations  list operations in document
  --[no-]schemas     list schemas in document

EXAMPLES
  $ openapi info https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml
  $ openapi info ./openapi.yml

See code: src/commands/info.ts

openapi init

initialise an OpenAPI definition file

USAGE
  $ openapi init

OPTIONS
  -S, --server=http://localhost:9000  add servers to definition
  -T, --title=title                   [default: My API] The title for the API
  -d, --description=description       Description for the API
  -f, --format=(json|yaml|yml)        [default: yaml] output format
  -h, --help                          show CLI help
  -v, --version=version               [default: 0.0.1] Version of the API
  --json                              format as json (short for -f json)
  --license=mit|apache2               The license for the API
  --terms=terms                       A URL to the Terms of Service for the API.
  --yaml                              format as yaml (short for -f yaml)

EXAMPLE
  $ openapi init --title 'My API' > openapi.yml

See code: src/commands/init.ts

openapi load DEFINITION

load an openapi definition file (writes to .openapiconfig)

USAGE
  $ openapi load DEFINITION

ARGUMENTS
  DEFINITION  input definition file

OPTIONS
  -V, --validate  validate against openapi schema
  -h, --help      show CLI help

EXAMPLES
  $ openapi load ./openapi.yml
  $ openapi load https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml

See code: src/commands/load.ts

openapi mock [DEFINITION]

start a local mock API server

USAGE
  $ openapi mock [DEFINITION]

ARGUMENTS
  DEFINITION  input definition file

OPTIONS
  -U, --swagger-ui=docs  Swagger UI endpoint
  -h, --help             show CLI help
  -p, --port=9000        [default: 9000] port
  --[no-]logger          [default: true] log requests

EXAMPLES
  $ openapi mock ./openapi.yml
  $ openapi mock https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml

See code: src/commands/mock.ts

openapi read [DEFINITION]

read, parse and convert OpenAPI definitions

USAGE
  $ openapi read [DEFINITION]

ARGUMENTS
  DEFINITION  input definition file

OPTIONS
  -D, --dereference                   resolve $ref pointers
  -S, --server=http://localhost:9000  add servers to definition
  -V, --validate                      validate against openapi schema
  -f, --format=(json|yaml|yml)        [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)

EXAMPLES
  $ openapi read https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml
  $ openapi read ./openapi.yml -f json > openapi.json

See code: src/commands/read.ts

openapi swagger-editor [DEFINITION]

serve a local Swagger UI instance

USAGE
  $ openapi swagger-editor [DEFINITION]

ARGUMENTS
  DEFINITION  input definition file

OPTIONS
  -h, --help       show CLI help
  -p, --port=9000  [default: 9000] port
  --[no-]logger    [default: true] log requests

EXAMPLES
  $ openapi swagger-editor
  $ openapi swagger-editor ./openapi.yml
  $ openapi swagger-editor ./openapi.yml --bundle static

See code: src/commands/swagger-editor.ts

openapi swagger-ui [DEFINITION]

serve or bundle a Swagger UI instance

USAGE
  $ openapi swagger-ui [DEFINITION]

ARGUMENTS
  DEFINITION  input definition file

OPTIONS
  -B, --bundle=outDir                 bundle a static site to directory
  -S, --server=http://localhost:9000  add servers to definition
  -h, --help                          show CLI help
  -p, --port=9000                     [default: 9000] port
  --[no-]deeplinks                    [default: true] allow deep linking
  --expand=full|list|none             [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"

EXAMPLES
  $ openapi swagger-ui
  $ openapi swagger-ui ./openapi.yml

See code: src/commands/swagger-ui.ts

openapi swagger2openapi [DEFINITION]

convert Swagger 2.0 definitions to OpenAPI 3.0.x

USAGE
  $ openapi swagger2openapi [DEFINITION]

ARGUMENTS
  DEFINITION  input definition file

OPTIONS
  -D, --dereference                   resolve $ref pointers
  -S, --server=http://localhost:9000  add servers to definition
  -V, --validate                      validate against openapi schema
  -f, --format=(json|yaml|yml)        [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)

EXAMPLE
  $ openapi swagger2openapi --yaml ./swagger.json > openapi.yml

See code: src/commands/swagger2openapi.ts

openapi unload

unload an openapi definition file (writes to .openapiconfig)

USAGE
  $ openapi unload

OPTIONS
  -h, --help  show CLI help

EXAMPLE
  $ openapi unload

See code: src/commands/unload.ts

Contributing

OpenAPI Backend is Free and Open Source Software. Issues and pull requests are more than welcome!

The Chilicorn

Current Tags

  • 0.1.7                                ...           latest (a month ago)

31 Versions

  • 0.1.7                                ...           a month ago
  • 0.1.6                                ...           a month ago
  • 0.1.5                                ...           a month ago
  • 0.1.4                                ...           a month ago
  • 0.1.3                                ...           a month ago
  • 0.1.2                                ...           a month ago
  • 0.1.1                                ...           a month ago
  • 0.1.0                                ...           a month ago
  • 0.0.23                                ...           a month ago
  • 0.0.22                                ...           a month ago
  • 0.0.21                                ...           a month ago
  • 0.0.20                                ...           a month ago
  • 0.0.19                                ...           a month ago
  • 0.0.18                                ...           a month ago
  • 0.0.17                                ...           a month ago
  • 0.0.16                                ...           2 months ago
  • 0.0.15                                ...           2 months ago
  • 0.0.14                                ...           2 months ago
  • 0.0.13                                ...           4 months ago
  • 0.0.12                                ...           4 months ago
  • 0.0.11                                ...           4 months ago
  • 0.0.10                                ...           4 months ago
  • 0.0.9                                ...           4 months ago
  • 0.0.8                                ...           4 months ago
  • 0.0.7                                ...           4 months ago
  • 0.0.6                                ...           4 months ago
  • 0.0.5                                ...           4 months ago
  • 0.0.4                                ...           4 months ago
  • 0.0.3                                ...           4 months ago
  • 0.0.2                                ...           4 months ago
  • 0.0.1                                ...           4 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 31
Last Day 0
Last Week 0
Last Month 341
Dependencies (20)
Dev Dependencies (19)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |