Skip to main content

openapi cli tool

Project description

openapi-cli-tool

Build Status

openapi-cli-tool

OpenAPI (Swagger 3.x) CLI Tool.

  • Supports multi file extension (json|yaml|yml).
  • List up defined APIs.
  • Display an API specification which is resolved $ref.
  • Bundle multi-file into one.
  • OAS interactive scaffold.

Installation

Execute Python installation command on your machine.
Supports Python 2.7, 3.4 <=.

$ python setup.py install

Then openapi-cli-tool command is installed.

Usage

$ openapi-cli-tool --help
Usage: openapi-cli-tool [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  bundle    Bundle multi-file into one.
  list      List up APIs in a specific file or directory.
  resolve   Display `$ref` resolved API specification.
  scaffold  Interactively create a simple OpenAPI Specification.

Bundle

Bundle multi-file specifications into one, regardless of file extension (json|yaml|yml).

$ openapi-cli-tool bundle --help
Usage: openapi-cli-tool bundle [OPTIONS] FILE_PATH

  Bundle multi-file into one.

Options:
  -f, --file TEXT  Load common objects such as info and servers from a
                   specific file. Default is a file which is the top of list
                   command result.
  -t, --type TEXT  Export data type. {json|yaml}  [default: json]
  --help           Show this message and exit.

example:

$ openapi-cli-tool bundle FILE_PAH > ./specification.json

List

List up APIs from specification file/directory regardless of file extension (json|yaml|yml).

$ openapi-cli-tool list [spec-path]

Method    Path       File
--------  ---------  ------------------------------------------
PUT       /avatar    ./tests/resources/spec/sample.yml
GET       /follwers  ./tests/resources/spec/folder1/sample2.yaml
POST      /follwers  ./tests/resources/spec/folder1/sample2.yaml
PUT       /follwers  ./tests/resources/spec/folder1/sample2.yaml
POST      /pets      ./tests/resources/spec/sample.yml
GET       /posts     ./tests/resources/spec/folder1/sample.json
POST      /posts     ./tests/resources/spec/folder1/sample.json
GET       /users     ./tests/resources/spec/folder1/sample.json
POST      /users     ./tests/resources/spec/folder1/sample.json

Resolve

Display an API specification which is resolved multi-file API specification via $ref pointers.

Usage: openapi-cli-tool resolve [OPTIONS] METHOD PATH FILE_PATH

  Display `$ref` resolved API specification.

Options:
  -t, --type TEXT  Export data type. {json|yaml}  [default: json]
  --help           Show this message and exit.

example:

$ openapi-cli-tool resolve post /cats ./tests/resources/spec

Scaffold

Interactively input information of your API.
A simple OpenAPI Specification is generated on your prompt.

$ openapi-cli-tool scaffold

Please enter title [""]: sample
Please enter version [v1.0]:
Please enter license [Apache 2.0]:
Please enter server url [http://example.com]:
Please enter path [/]: /example
Please enter method for /example [get|post|put|delete|head|option|trace]: get
Please enter description for get /example [""]: sample get endpoint
Please enter response code for get /example [200]:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openapi-cli-tool-0.1.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distributions

openapi_cli_tool-0.1.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

openapi_cli_tool-0.1.2-py2-none-any.whl (9.4 kB view details)

Uploaded Python 2

File details

Details for the file openapi-cli-tool-0.1.2.tar.gz.

File metadata

  • Download URL: openapi-cli-tool-0.1.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.5.6

File hashes

Hashes for openapi-cli-tool-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2020eed96ca70ed87b83e8039f8ebb340c9fd1715330eddd0b1b26c2edf78945
MD5 55cf6feda7bafff9137fd3d215e56cea
BLAKE2b-256 ef7e0729add2d9af00835326beabfd5d5c242f84282fbec5116d7c18976ea01c

See more details on using hashes here.

File details

Details for the file openapi_cli_tool-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: openapi_cli_tool-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.5.6

File hashes

Hashes for openapi_cli_tool-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 211ea58c66f7dfd918d239fe54308e8f5168d15478615a5123704593196c2ee1
MD5 fd5541a7ad51629adbc77657405a4c7e
BLAKE2b-256 896fe6b6fa0ce4210b5896340722e103193807a434f0b9ed6481229a82d95bcd

See more details on using hashes here.

File details

Details for the file openapi_cli_tool-0.1.2-py2-none-any.whl.

File metadata

  • Download URL: openapi_cli_tool-0.1.2-py2-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/2.7.14

File hashes

Hashes for openapi_cli_tool-0.1.2-py2-none-any.whl
Algorithm Hash digest
SHA256 8cc1c1e91e9cde634377430f630a2ced807a974379ea3900def36a8ef531d690
MD5 f957f7225d235733885edcfcc928e796
BLAKE2b-256 be867c0cc8d6c2d671ec0f662b94084cc8255a57ab37467b6003b0880f988fc8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page