CLI tool to generate Postman Documentation from Swagger and update a Collection.
Postman supports syncing schema syncing with GitHub but currently requires the manual generation of a documentation collection from the schema. Codified schema updates therefore create a new collection each sync or manually validating the schema to sync, necessitating another process of reconciling updates with published documentation.
This tool does the following:
- Updates a Postman API schema with a given Swagger definition.
- Converts the Swagger definition into OpenAPI 3 using swagger2openapi.
- Converts the OpenAPI definition into a Postman Collection using openapi-to-postman.
- Updates given Documentation Collection with the converted one.
$ npm install -g swagger2-postman-doc
$ swagger2-postman-doc COMMAND
running command...
$ swagger2-postman-doc (-v|--version|version)
swagger2-postman-doc/3.1.1 darwin-x64 node-v12.14.1
$ swagger2-postman-doc --help [COMMAND]
USAGE
$ swagger2-postman-doc COMMAND
...
swagger2-postman-doc hapi HOST
swagger2-postman-doc help [COMMAND]
swagger2-postman-doc postman FILE APIKEY APIID APIVERSIONID SCHEMAID COLLECTIONUID
Generate Swagger from Hapi Swagger.
USAGE
$ swagger2-postman-doc hapi HOST
ARGUMENTS
HOST Hapi Swagger host
OPTIONS
-h, --help show CLI help
-o, --output=output swagger output path
See code: src/commands/hapi.ts
display help for swagger2-postman-doc
USAGE
$ swagger2-postman-doc help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
Generate Postman Documentation from Swagger and update a Collection.
USAGE
$ swagger2-postman-doc postman FILE APIKEY APIID APIVERSIONID SCHEMAID COLLECTIONUID
ARGUMENTS
FILE Path to Swagger file
APIKEY Postman API key
APIID Postman API Id
APIVERSIONID Postman API Version Id
SCHEMAID Postman API Schema Id
COLLECTIONUID Postman API Documentation Collection Uid
OPTIONS
-h, --help show CLI help
-o, --output=output Postman Collection output path
--exampleParametersResolution=schema|example [default: example] Swagger to Postman Collection: generate the response
parameters based on the schema or example
--folderStrategy=paths|tags [default: tags] Swagger to Postman Collection: create folders according
to the spec’s paths or tags
--requestParametersResolution=schema|example [default: schema] Swagger to Postman Collection: generate the request
parameters based on the schema or example
See code: src/commands/postman.ts