Skip to content

Instantly share code, notes, and snippets.

@EnesKorukcu
Last active November 5, 2019 14:59
Show Gist options
  • Save EnesKorukcu/d8daac9dc7fdaa7ba3d3d172fb2172ba to your computer and use it in GitHub Desktop.
Save EnesKorukcu/d8daac9dc7fdaa7ba3d3d172fb2172ba to your computer and use it in GitHub Desktop.
Import swagger json into postman
//
// This script creates a postman.json file from swagger.json which can be imported into postman.
// 1. Replace "YOUR_PROJECT_URL" with real url which points to swagger.json.
// 2. Give permission to run: "chmod +x swagger_json_to_postman_json.sh"
// 3. Execute the script: "./swagger_json_to_postman_json.sh"
// 4. postman.json will be created in the same folder as script.
//
git clone https://github.com/postmanlabs/openapi-to-postman.git
cd openapi-to-postman
npm i
curl http://YOUR_PROJECT_URL/swagger.json --output swagger.json
sed -i '' '2i\
"openapi":"3.0",' swagger.json
node ./bin/openapi2postmanv2 -s swagger.json -o ../postman.json
cd ..
rm -rf openapi-to-postman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment