swagger through annotation indicates that this interface will generate documentation, including interface name, request methods, parameters, return information, and so on.
swagger2 common comment:
@Api: modification of the entire class, describe the role of Controller
@ApiOperation: describes a method of a class or an interface
@ApiParam: single parameter Description
@ApiModel: receiving the object parameters
@ApiProperty: Upon receiving the object parameters, a description of the object field
@ApiResponse: HTTP response is described wherein a
@ApiResponses: HTTP response Overall description
@ApiIgnore: use the API to ignore this comment
@ApiError: Error returned occur
@ApiImplicitParam: a request parameter
@ApiImplicitParams: a plurality of request parameters
Notes the corresponding parameter parsing:
@Api: used on request class, an explanation of the class
tags = "explained the role of the class, you can see on the UI interface notes"
value = "The argument does not make sense, in the UI interface also see so no need to configure "
@ApiOperation: The method used in the request that the use of the process, the role of
value = "Use of the method described, the role of"
Notes = "Method Remarks"
@ApiImplicitParams: The method used in the request indicating a set of parameters Description
@ApiImplicitParam: annotation used in @ApiImplicitParams, specify various aspects of a request parameter
name: name of the parameter
value: Character description parameters, explanation
required: whether the parameter must pass
paramType: parameters on which place
· header -> request parameter acquisition: @RequestHeader
· Query -> request parameter acquisition: @RequestParam
· path (for restful Interface) -> request parameter acquisition: @PathVariable
· body (not used)
· form (not used)
dataType: parameter type, default String, if the argument is an integer, for dataType = "integer", swagger2 appears to be invalid, can only be used int
defaultValue: the default value of the parameter
@ApiResponses: used in the method of the request, the response indicates a set
@ApiResponse: @ApiResponses used in the general expression for an error response message
code: number, for example 400
Message: information, e.g., "request parameter Motian good"
response: throwing an exception class
@ApiModel: in response to the class information represents a return response data
(which is generally used in a post created when using such a scene @RequestBody,
when not using the parameters of the request for annotations described @ApiImplicitParam)
@ApiModelProperty: with on the properties that describe attributes of the class in response
Please refer to my GitHub: https://github.com/yaoshuangqi/maven-parent.git