当前位置:网站首页>Swagger重点配置项
Swagger重点配置项
2022-07-20 04:41:00 【蓝天⊙白云】
1. Swagger中paramType
Swagger中paramType
paramType:表示参数放在哪个地方
header–>请求参数的获取:@RequestHeader(代码中接收注解)
query–>请求参数的获取:@RequestParam(代码中接收注解)
path(用于restful接口)–>请求参数的获取:@PathVariable(代码中接收注解)
body–>请求参数的获取:@RequestBody(代码中接收注解)
form(不常用)
demo_form:
@PostMapping(value = "add", headers = "content-type=multipart/form-data")
@ApiOperation("附件保存接口(多文件上传不支持swagger测试)")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "*id", example = "10086", paramType = "form", required = true),
@ApiImplicitParam(name = "status", value = "附件状态", example = "3",
paramType = "form", allowableValues = "2,3", required = true)
})
public Result add(AddDTO addDTO,
@ApiParam(value = "*附件") @RequestParam(value = "materialSigns", required = false)
MultipartFile[] file,
) {
2. dataType的设置
allowMultiple:允许多个,即:数组或集合。
dataType:数组或集合的元素类型,即:类名。
自定义类型的注解配置
@ApiModel(value = "UserDto", description = "用户")
public class User implements Serializable {
//...
}
如果元素类型为原生类型,如:int、String之类的,无需此步骤。
如果元素类型为自定义类型,如:UserDto,则必须此步骤,以便swagger能够找到这个元素对应的类型。
边栏推荐
- [disadvantages of select and poll, and advantages of epoll]
- AI2 (APP inventor 2) offline version
- Buying insight and channel evaluation help optimize marketing decisions
- Practice of online problem feedback module (VIII): realize image upload function (Part 1)
- How to choose data application development language and environment
- vivo官网APP全机型UI适配方案
- STL vector的操作
- Release test
- 使用 NSProxy 实现消息转发
- Returns the string representation of the last date in a given date month
猜你喜欢
[1000 cases of ArcGIS micro courses] 0029: ArcGIS drawing parallel lines (constructing parallel roads)
Interpreting the implementation principle of go Distributed Link Tracking
Deep learning 2-linear unit and gradient descent
Software testing career development direction (don't be confused, roll up quickly)
How should enterprise users choose aiops or APM?
【SELECT、POLL的缺点,以及EPOLL的优势】
[Muduo log system 2] timestamp time
[Android開發學iOS系列] 語言篇: Swift vs Kotlin
织梦DEDE后台系统用户管理显示空白的解决方法
[Android development IOS series] Language: swift vs kotlin
随机推荐
Construction and practice of full stack code test coverage and use case discovery system
vivo官网APP全机型UI适配方案
Structure completion (flexible array)
How to protect user privacy without password authentication?
How to add columns in PPT histogram
解决OpenCV读取视频结束后报错的问题
Interpreting the implementation principle of go Distributed Link Tracking
Introduction to Command Line
Detailed explanation of getchar () function in C language
Calculate the number of days from today
开发中常见环境配置名词-dev、sit、pro、fac等
NFT fashion shoes ar interactive zero foundation tutorial is coming!
华为通用卡证识别功能,一键实现多种卡绑定
【微信小程序】文本域输入带最大字数限制(1/100)
【MUDUO】构建项目编译CMake文件以及noncopyable
Using nsproxy to forward messages
From concept to security practice: a basic guide to software supply chain
[Muduo log system 1] logger output
How to delete different text in Excel spreadsheet in batch?
Vivo official website app full model UI adaptation scheme