当前位置:网站首页>Swagger key configuration items
Swagger key configuration items
2022-07-25 03:15:00 【Blue sky ⊙ white clouds】
1. Swagger in paramType
Swagger in paramType
paramType: Indicates where the parameter is placed
header–> Get request parameters :@RequestHeader( Receiving comments in code )
query–> Get request parameters :@RequestParam( Receiving comments in code )
path( be used for restful Interface )–> Get request parameters :@PathVariable( Receiving comments in code )
body–> Get request parameters :@RequestBody( Receiving comments in code )
form( Not commonly used )
demo_form:
@PostMapping(value = "add", headers = "content-type=multipart/form-data")
@ApiOperation(" Attachment saving interface ( Multi file upload is not supported swagger test )")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "*id", example = "10086", paramType = "form", required = true),
@ApiImplicitParam(name = "status", value = " Attachment status ", example = "3",
paramType = "form", allowableValues = "2,3", required = true)
})
public Result add(AddDTO addDTO,
@ApiParam(value = "* The attachment ") @RequestParam(value = "materialSigns", required = false)
MultipartFile[] file,
) {

2. dataType Set up
allowMultiple: Allow multiple , namely : Array or collection .
dataType: The element type of an array or collection , namely : Class name .
Annotation configuration of custom type
@ApiModel(value = "UserDto", description = " user ")
public class User implements Serializable {
//...
}
If the element type is native , Such as :int、String And so on. , There is no need for this step .
If the element type is a custom type , Such as :UserDto, This step is necessary , In order to swagger You can find the corresponding type of this element .
边栏推荐
- JS written test question -- prototype, new, this comprehensive question
- Learning record XIII
- Openlayers draw circles and ellipses
- mysql_ Account authorization permission recycling, account locking and unlocking, account creation and deletion
- Stm32cubemx quadrature encoder
- Define macros in makefile and pass them to source code
- Read and upgrade st-link chip information and SWD burning media through STM32 stlink utility tool
- Unity refers to a variable in another class (its own instance)
- Keras load history H5 format model error: attributeerror 'STR' object has no attribute 'decode‘
- JS written test question -- browser kernel
猜你喜欢

JS foundation -- JSON

Brief understanding of operational amplifier

How to use two queues to simulate the implementation of a stack

Select sort / cardinality sort

Keil compile download error: no algorithm found for: 08000000h - 08001233h solution

Vscode configuration, eslint+prettier combined with detailed configuration steps, standardized development

How does Jupiter notebook change themes and font sizes?

B. Almost Ternary Matrix

The latest interview questions and analysis of software testing in 2022

JS written test question -- promise, setTimeout, task queue comprehensive question
随机推荐
Unity refers to a variable in another class (its own instance)
Solve ''_ Xsrf 'argument missing from post
kettle_ Configure database connection_ report errors
B. Making Towers
Riotboard development board series notes (4) -- using Vpu hardware decoding
JS interview question - what is the difference between Es5 and ES6?
mysql_ Create temporary table
Backtracking to solve subset problem
Daily three questions 7.19
Clothing ERP | ten advantages of clothing ERP for enterprises
Threat report in June: new bank malware malibot poses a threat to mobile banking users
Wechat H5 record
Decoding webp static pictures using libwebp
New features commonly used in ES6
Recursive and non recursive methods are used to realize the first order, middle order and second order traversal of binary tree respectively
Domestic edge computing organization and product research
Print the common part of two ordered linked lists
New key points of ES6
Inheritance (prototype)
JS construction linked list