swagger注解
来源:互联网 发布:华为端口镜像配置 编辑:程序博客网 时间:2024/05/22 12:17
转自:http://www.cnblogs.com/yuan951/p/7243383.html
swagger注解
API详细说明
注释汇总
@RequestMapping此注解的推荐配置
value
method
produces
示例:
@ApiOperation("信息软删除") @ApiResponses({ @ApiResponse(code = CommonStatus.OK, message = "操作成功"), @ApiResponse(code = CommonStatus.EXCEPTION, message = "服务器内部异常"), @ApiResponse(code = CommonStatus.FORBIDDEN, message = "权限不足") }) @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "Long", name = "id", value = "信息id", required = true) }) @RequestMapping(value = "/remove.json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public RestfulProtocol remove(Long id) {
@ApiModelProperty(value = "标题") private String title;
- 1
- 2
@ApiImplicitParam
paramType 示例详解
path
@RequestMapping(value = "/findById1/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @PathVariable(name = "id") Long id
body
@ApiImplicitParams({ @ApiImplicitParam(paramType = "body", dataType = "MessageParam", name = "param", value = "信息参数", required = true) }) @RequestMapping(value = "/findById3", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestBody MessageParam param 提交的参数是这个对象的一个json,然后会自动解析到对应的字段上去,也可以通过流的形式接收当前的请求数据,但是这个和上面的接收方式仅能使用一个(用@RequestBody之后流就会关闭了)
header
@ApiImplicitParams({ @ApiImplicitParam(paramType = "header", dataType = "Long", name = "id", value = "信息id", required = true) }) String idstr = request.getHeader("id"); if (StringUtils.isNumeric(idstr)) { id = Long.parseLong(idstr); }
- 1
- 2
- 3
- 4
- 5
- 6
Form
@ApiImplicitParams({ @ApiImplicitParam(paramType = "form", dataType = "Long", name = "id", value = "信息id", required = true) }) @RequestMapping(value = "/findById5", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
阅读全文
0 0
- swagger注解
- swagger注解
- Swagger注解
- swagger注解说明
- swagger常用注解
- springboot + swagger 注解
- swagger常用注解说明
- swagger 常用注解
- swagger常用注解
- springboot + swagger注解
- swagger常用注解
- swagger注解 详细说明
- swagger注解说明
- swagger注解的使用
- swagger常用注解说明
- swagger常用注解说明
- springboot + swagger一些注解总结
- Swagger的三个常用注解
- netty原理
- 简单详细解决python版本共存问题
- zxing实现简单二维码生成和解析
- DNS预解析(dns-prefetch)
- Weblogic学习(一) 开发模式与生产模式
- swagger注解
- Oracle-->基础知识-->Oracle 数据库目录 ORACLE_BASE ORACLE_HOME
- 获取安卓app的签名
- exec族函数
- Redis超级新手指南-下
- 滴滴面试记录
- Spring中Bean的理解以及@Bean的作用
- 测试requests
- 字符串替换空格