First of all, you must know that @ApiModelProperty is an annotation of swagger. Its function is to add and operate the data of the attribute module. The following are the commonly used attributes inside it:
1、value()
Source code: String value() default "";
The parameter type is String, which serves as a brief description of this attribute.
2、name()
Source code: String name() default "";
The parameter type is String, which is used to allow the name of the attribute to be overridden.
3、allowableValues()
Source code: String allowableValues() default "";
The parameter type is String, which is used to allow the length of storage of this parameter.
4、access()
Source code: String access() default "";
The parameter type is String, which allows filtering attributes from API documents.
5、notes()
Source code: String notes() default "";
The parameter type is String, which serves as the note description of the field.
6、dataType()
Source code: String dataType() default "";
The parameter type is String, which acts as the data type of the parameter.
7、required()
Source code: boolean required() default false;
the parameter type is boolean, which is used to specify whether the parameter can be empty. The default is false.
8、 position()
Source code: int position() default 0;
the parameter type is int, which allows the attributes in the model to be sorted explicitly.
9、hidden()
Source code: boolean hidden() default false;
the parameter type is boolean, and its function is whether to allow model attributes to be hidden in the Swagger model definition. The default is false.
10、example()
Source code: String example() default "";
The parameter is of String type and serves as the example value of the attribute.
11、readOnly()
Source code: boolean readOnly() default false;
the parameter type is boolean, and its function is whether to allow the attribute to be specified as read-only. The default is false.
12、reference()
Source code: String reference() default "";
The parameter type is String, which is used to specify a reference to the corresponding type definition and override any other specified data name.
13、allowEmptyValue()
Source code: boolean allowEmptyValue() default false;
the parameter type is boolean, and its function is whether to allow empty values to be passed. The default is false.
Example:
@ApiModelProperty(value = "主键",name = "id",
allowableValues = "32",
access = "1",
notes = "用户的id",
dataType = "int",
required = false,
position = 1,
hidden = true,
example = "1",
readOnly = false,
reference = "id",
allowEmptyValue = false)
@TableId(value = "id",type = IdType.AUTO)
private int id;