Five, Swagger annotations
1、@Api
Identify a description of a module, generally used for class annotations of restful interfaces
Commonly used attributes:
1) value: used for the title description of the interface module, it seems that it is not available after version 1.5
2) tags: title description for the interface module
3) description: Describe the detailed information of the interface class, the subtitle, although it works, it may be discarded later
4) produces: the types of resources that the interface can return, separated by commas, such as: "application/json, application/xml"
5) consumes: The types of resources that the interface can accept, separated by commas, such as: "application/json, application/xml"
6) protocols: transport protocols supported by the interface, separated by commas, possible values: http, https, ws, wss
7) hidden: Whether to hide in the document, the default is false; in fact, it is more convenient to use the annotation @ApiIgnore.
2. ApiOperation
describes
the common attributes of annotations for specific api operations:
1) value: summary of api operations
2) notes: Repeated description of api operations
3) tags: a list of tags for api document version control starting from version 1.5.2
4) response: the corresponding type of operation, the default Void.class
5) responseContainer: describes the corresponding container, valid values: "List", "Set" or "Map"; other values are ignored
6) responseReference: the corresponding reference, which may be a local or remote reference
7)httpMethod:"GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS" and "PATCH"
3、@ApiModel
Defines the model data used in the interface
1) value: the name of the model
2) description: detailed description
3) parent: whether there is a parent class, the default Void.class
4) subTypes: whether there are subclasses that inherit this type
5) reference: referenced related classes
4. @ApiModelProperty
describes the attribute annotation of the data model
1) value: the meaning of the model attribute
2) allowableValues: allowed values, for example: range[1, 5]
3) dataType: data type
4) required: whether there must be a value, the default is false
5) example: an example of attribute value
6) readOnly: read-only attribute
7) reference: whether this attribute refers to other classes
8) allowEmptyValue: Whether to allow empty values, the default is false