/convert-docs

Convert Postman Collection API docs from json to yaml and upload to redoc Docker image

Primary LanguageJavaScript

Convert Docs

Converts _.postman_collection.json to an output.yaml and previews it via ReDoc Docker image


Usage Instructions

Start by going to command line and enter:

npm install

and

npm start

then export a Postman collection to postman_collection directory

The command will:

  1. pm2 will capture the change in the postman_collection directory, then run preview-docs.sh
  2. node index.js which will convert postman_collection.json file to output.yaml file
  3. build Docker garuda-docs-image and remove garuda-docs-container if it exists
  4. create Docker garuda-docs-container
  5. open http://localhost:4444/ with a preview. Please refresh page to see latest and greatest

Prerequisites

To run this application on Windows 11, I needed:

sudo service docker status
  • Pull the docker image
sudo docker pull redocly/redoc
  • Serve remote spec by URL
sudo docker run -it --rm -p 80:80 -e SPEC_URL='http://localhost:8000/swagger.yaml' redocly/redoc
  • Serve local file

sudo docker run -it --rm -p 80:80 -v /mnt/{{pwd}}/output.yaml:/usr/share/nginx/html/swagger.yaml -e SPEC_URL=swagger.yaml redocly/redoc
  • Serve local file and watch for updates
sudo docker run -it --rm -p 80:80 -v /mnt/{{pwd}}/:/usr/share/nginx/html/swagger -e SPEC_URL=swagger/output.yaml redocly/redoc
  • Screenshot of ReDoc image commands in Ubuntu