swagger前后端使用说明
来源:互联网 发布:windows平板电脑 编辑:程序博客网 时间:2024/06/06 17:47
editor中yaml配置文件
swagger: '2.0'info: description: '共1个接口' version: 1.0.0 title: XXX接口 license: name: springMVC前后端交互说明 url: 'http://192.168.2.206/rdms-login-center/wmf/'host: 192.168.2.206tags: - name: XX系统 description: '四种请求get/post/put/delete。Content-Type是两种类型application/json和multipart/form-data,在consumes中定义。返回类型都是application/json,produces中定义。入参类型有path/query/formData/body。'schemes: - httppaths: /user/{id}: post: tags: - XX系统 summary: '操作用户信息' description: 'multipart/form-data接口,multipart针对文件上传,非文件上传可以省略;后端接收参数时也可以直接用实体类作为入参' consumes: - multipart/form-data produces: - application/json parameters: - name: id in: path description: path参数,前端直接拼接到url后即可,后端对应springmvc的@PathVariable;required可以省略,描述是否必填项;type可以是array/boolean/integer/null/number/object/string required: true type: integer - name: name in: query description: query参数,前端用?拼接,后端对应@RequestParam type: string - name: img in: formData description: formData参数,文件,配合consumes:- multipart/form-data,前端指定Content-Type:multipart/form-data,后端用@RequestParam("img") MultipartFile img接收文件参数,也可以接收数组@RequestParam("img") MultipartFile[] imgs type: file - name: sex in: formData description: formData参数,基本属性,后端用@RequestParam接收参数 type: string responses: '200': description: 返回用户信息 schema: $ref: '#/definitions/User' '201': description: '直接返回数组' schema: type: array description: 信息数组 items: $ref: '#/definitions/User' '202': description: '分页查询返回' schema: type: array description: 信息数组 items: $ref: '#/definitions/PageObject' '203': description: '自定义返回属性' schema: type: object description: 接口异常返回对象 properties: code: description: 0代表正常 type: integer '500': description: 异常返回 schema: $ref: '#/definitions/ErrorResponseBody' /man: put: tags: - XX系统 summary: '操作用户信息' description: 'application/json接口;后端接收参数时也可以直接用实体类作为入参' produces: - application/json parameters: - name: body in: body required: true description: 'body参数,也可以直接引用实体schema:$ref: #/definitions/User;前端Content-Type:application/json,请求体放入json对象,js编写方式是JSON.stringify(obj)后端用@RequestBody接收 ' schema: type: object properties: name: type: string description: 站点名称,必填 responses: '200': description: 返回用户信息 schema: $ref: '#/definitions/User' definitions: User: type: object description: 实体 properties: id: description: 属性,type可以是array/boolean/integer/null/number/object/string type: integer imgList: type: array description: 数组,自定义属性 items: type: object properties: stationId: description: id type: integer img1List: type: array description: $ref直接引用 items: $ref: '#/definitions/User' ErrorResponseBody: type: object description: 接口异常返回对象 properties: code: description: 0代表正常 type: integer message: description: 描述信息 type: string PageObject: type: object description: 分页接口返回对象 properties: content: description: 记录 type: array items: type: object last: description: 是否最后一页 type: boolean totalPages: type: integer description: 总页数 totalElements: type: boolean description: 总记录数 size: type: integer description: 分页大小 number: type: integer description: 当前页序号 sort: type: array description: 排序对象 items: type: object properties: direction: description: 排序类型asc/desc type: string property: description: 排序字段 type: string ascending: description: 升序 type: boolean first: type: boolean description: 是否第一页
预览
下载
需要2积分,坑爹,我想免积分的,没积分的也可以联系我
http://download.csdn.net/download/wm5920/10123823
阅读全文
0 0
- swagger前后端使用说明
- Swagger - 前后端分离后的契约
- Swagger - 前后端分离后的契约
- Swagger - 前后端分离后的契约
- Swagger - 前后端分离后的契约
- Swagger下的前后端协作
- iOS前后端分离Swagger使用 swagger ISO8016报错
- Swagger--连接前后端的通道
- jfinal+Swagger轻松配置前后端接口文档
- 【swagger】前后端分离联调利器——swagger安装和使用
- Spring Boot 菜鸟教程 9 swagger-前后端分离后的标准
- 一个API设计工具——Swagger,将如何帮助我们更好的实现“前后端分离”
- 前后端解耦 前后端分离
- cocos2dx 前后端交互
- 前后端纪事
- web前后端分离
- 前后端协议
- 前后端交互方式
- 如何成为一名成功的程序员
- 身为程序员的你是不是经常说这几句话呢?
- Android中View的绘制流程
- static的作用解析
- 优秀程序员的炼成记!
- swagger前后端使用说明
- Hibernate常用的接口和类Session&Transaction(四)
- 谷歌、微软、OpenAI 等巨头的机器学习开源项目
- (原创)Android6.0亮屏流程分析
- 多线程下载视频
- numpy.core.multiarray failed to import
- Java线程状态转换
- 朴素贝叶斯(Naive Bayes),“Naive”在何处?
- 传入当前的经纬度和目标经纬度,计算两点间距离