启动 Editor:docker run -d -p 38080:8080 swaggerapi/swagger-editor:v4.6.0
启动 UI:docker run -d -p 38081:8080 swaggerapi/swagger-ui:v4.15.5
浏览器访问 http://localhost:38080(编辑)与 http://localhost:38081(调试),在 UI 中点击 Try it out 填写参数并发送请求,适合快速冒烟与回归验证。
没有 UI 时,直接用 curl 按规范构造请求,覆盖常见场景(查询、表单、JSON、文件上传):
GET 查询:curl “http://host:port/client/selectByPage?limit=10&page=1”
POST 表单:curl -X POST http://host:port/factory/insert -H “Content-Type: application/x-www-form-urlencoded” -d “factoryName=Test&no=123”
POST JSON:curl -X POST http://host:port/material/selectAll -H “Content-Type: application/json” -d ‘{“factory”:“Test”,“materialName”:“Mat”,“offset”:0,“page”:1,“pageSize”:10}’
文件上传:curl -X POST http://host:port/api/order/money -F “file=@/path/file” -F “startTime=2020-01-01” -F “endTime=2020-06-30”。