Swagger教程

swagger2教程

https://www.ibm.com/developerworks/cn/java/j-using-swagger-in-a-spring-boot-project/index.html

专职写api文档的
避免swagger2 参与业务

补充教程
https://blog.csdn.net/xiaojin21cen/article/details/78654652

  1. 本地地址
    http://localhost:8080/swagger-ui.html#/
  1. @ApiResponse

@ApiOperation("Create a new MyEntity")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "myEntity", dataType = "MyEntity", paramType = "body", required = true)
    })
    @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = MyEntity.class),
            @ApiResponse(code = 401, message = "Unauthorized"),
            @ApiResponse(code = 500, message = "Internal Server Error"),
            @ApiResponse(code = 400, message = "Bad Request"),
            @ApiResponse(code = 404, message = "Not Found") })
    @PostMapping
    public ResponseEntity<MyEntity> createMyEntity(@RequestBody Map<String, Object> request)

  1. @ApiImplicitParam datatype integer

https://github.com/springfox/springfox-demos/issues/18

dataType 正确写法

 @ApiImplicitParam(name = "age", value = "年龄", required = true, paramType = "form", dataType = "int")

你可能感兴趣的:(springboot,常用工具)