Skip to content

update postman collection from swagger json, to avoid create every time

License

Notifications You must be signed in to change notification settings

ysjiang4869/swagger2postman

Repository files navigation

UPDATE POSTMAN COLLECTION FROM SWAGGER

This tools can update postman collection from swagger json, to avoid create every time.

Note: The tools will merge old config with new, but for request body, it will keep the exist one, not merge.

Use

  1. Clone this repository

  2. Install packages

    Make sure you have install nodejs. Then in project root folder, run npm install to install libs.

  3. Get your postman api key
    Just open this link in your broswer, and generate your api key.

  4. Set api key as environment.
    Copy .env.sample to .env file, then set the api key you get in the previous step.

  5. Rename config/default-example.json file to config/default.json and edit like bellow

    {       
         "test":{
             "collection_name":"test import",
             "url":"http://127.0.0.1:8085/v2/api-docs"
         }
     }

    The key is command line value name.collection_name is the postman collection name you want to update. url is your swagger url.

  6. Run update
    In project root folder, open command line and run node index.js -s test
    you can also install as gloabl cli. run sudo npm link in root folder, then use apih -s test everywhere!

TODO

  • Merge same name collection

Reference

  1. openapi-to-postman/OPTIONS.md at develop · postmanlabs/openapi-to-postman
  2. Update Collection - Postman Public Workspace
  3. axios - npm
  4. postmanlabs/swagger2-postman2: Module and library to convert Swagger 2.0 to a Postman Collection (v2.0)
  5. boschni/json-merger: Merge JSON files and objects with indicators like $import $remove $replace $merge

About

update postman collection from swagger json, to avoid create every time

Resources

License

Stars

Watchers

Forks

Packages

No packages published