How to generate md or html interface documents from json files exported by PostMan

1. Download the docgen plugin and rename it

Download address : https://github.com/thedevsaddam/docgen

image-20220411163910178

After the download is complete, modify the name: docgen (D:\software\docgen path can be placed under the system environment variable path / it is also OK to leave it alone)

image-20220411163958880

image-20220411164605406

2. Execute to obtain the generated interface document

(Not added to the system environment variable) Execute cmd in the current directory and enter docgen

image-20220411165034615

Generate Interface Documentation Instructions

  • To view live HTML documents from the postman collection, use... This will open the html version of the postman collection to the defined port

    docgen server -f json文件地址 -p 8000
    
  • View live Markown docs from the postman collection using... this will open the markdown version of the postman collection to the defined port

    docgen server -f json文件地址 -p 8000 -m
    
  • Generate HTML documents using

    docgen build -i json文件地址 -o html文件地址和文件名
    
  • Generate Markdown documents using

    docgen build -i input-postman-collection.json -o md格式文件地址和文件名 -m
    

Example:

docgen server -f C:\Users\admin\Desktop\api\api.json -p 8000
docgen server -f C:\Users\admin\Desktop\api\api.json -p 8000 -m
docgen build -i C:\Users\admin\Desktop\api\api.json -o C:\Users\admin\Desktop\api\api.html
docgen build -i C:\Users\admin\Desktop\api\api.json -o C:\Users\admin\Desktop\api\api.md -m

Guess you like

Origin blog.csdn.net/m0_49969111/article/details/124116243