swagger generates api documentation

Significance of generating api documentation

The current software project is at every turn 1 million+
If you want to generate api, you must rely on automation tools.
Here is an introduction to the method of generating interface documents based on yaml

Download server

Set up proxy

# git clone http://...
git config --global http.proxy 'socks5://127.0.0.1:4781'
# git clone https://...
git config --global https.proxy 'socks5://127.0.0.1:4781'
# git clone git://...
git config --global core.gitproxy 'socks5://127.0.0.1:4781'

取消
git config --global --unset http.proxy
npm config set proxy=http://127.0.0.1:4780
npm config set registry=http://registry.npmjs.org
取消
npm config delete proxy
npm config delete registry

Download serve test server

sudo npm i serve -g

Download swagger local editor

git clone https://github.com/swagger-api/swagger-editor

cd swagger-editor

//启动服务器
serve

Take docker yaml as an example to put in the yaml api document

docker swarrer.yaml 位置

C:\Users\73444\Desktop\vsproj\moby\api\swagger.yaml

After running the server

serve

   ┌─────────────────────────────────────────────────┐
   │                                                 │
   │   Serving!                                      │
   │                                                 │
   │   - Local:            http://localhost:5000     │
   │   - On Your Network:  http://172.27.96.1:5000   │
   │                                                 │
   │   Copied local address to clipboard!            │
   │

Insert picture description here

Copy swarmer.yaml to the code and click Generate html2 to see the generated api document

Generated local docker api documentation

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43373608/article/details/107639836