knife4j:
Knife4j是一款可以提供在线API文档的框架,是基于Swagger框架实现的
也就是一些相较于之前 没使用过的注解:
@API
拥有两个属性:value、tags,源码如下
//If tags is not used,this value will be used to set the tag for the operations described by this resource. Otherwise, the value will be ignored.
String value() default "";
//Tags can be used for logical grouping of operations by resources or any other qualifier.
String[] tags() default {""};
@Api(tags = "list1")
@Api(tags = {"list1","list2"})
@ApiOperation
使用于在方法上,表示一个http请求的操作
源码中属性太多,记几个比较常用
value——用于方法描述
notes——用于提示内容
tags——可以重新分组
@ApiParam
使用在方法上或者参数上,字段说明;表示对参数的添加元数据(说明或是否必填等)
name–参数名
value–参数说明
required–是否必填
@ApiModel()
使用在类上,表示对类进行说明,用于参数用实体类接收
value–表示对象名
description–描述
@ApiModelProperty()
使用在方法,字段上,表示对model属性的说明或者数据操作更改
value–字段说明
name–重写属性名字
dataType–重写属性类型
required–是否必填
example–举例说明
hidden–隐藏