Postman OpenAPI sync
Postman OpenAPI sync makes sure that your local OpenAPI spec is in sync with Postman. It does that by using your local OpenAPI spec as the source of truth and synchronizing its contents with Postman.
Installing
To install postman-openapi-sync
simply clone this repository and then run:
npm install -g
postman-openapi-sync
will be installed globally on your system.
Running
To run postman-api-sync
you must first create two environment variables:
POSTMAN_API_KEY
: your Postman API key.POSTMAN_WORKSPACE_ID
: the ID of the workspace where you want to synchronize your API.
Then, you can simply run:
postman-openapi-sync <openapi_file>
Where openapi_file
is your local OpenAPI specification file.
Flow
- Read a local OpenAPI specification file.
- Obtain the local API name and version from the specification file.
- Check if there is an API with the same name on Postman.
- If not, create an API with the same name and description as the local OpenAPI specification.
- Create an API version with the same value as the local OpenAPI specification, if one doesn't already exist.
- Update the API schema with the value from the local OpenAPI specification.