API编写规范
说明
- 使用swagger编写
- 正式环境不开放
- 网址:http://site/swagger-ui.html
使用
- 函数定义
@ApiOperation(value = "名称", tags = { "所属模块" }, notes = "说明") // 比如模块有系統,账户,商城等
- 参数定义
可选项:required,dataType
@ApiImplicitParam(name = "json", value = "{\"ex\":false}。参数说明:ex(是否异常)", required = true, dataType = "string")
- 返回定义
@ApiResponse(code = 200, message = "{\"id\":1000}。参数说明:id(订单号)") // 成功返回 @ApiResponse(code = 500, message = "101,1000") // 错误返回,所有的特定业务返回码