当前位置:网站首页>Swagger2 shows that there is a problem with the get interface, which can be solved with annotations
Swagger2 shows that there is a problem with the get interface, which can be solved with annotations
2022-07-25 09:32:00 【Program Yuan who just wants to make money】
Code access swagger after , The successful running , but get The parameters displayed by the interface are body, This is not in line with

normal swagger It will appear get The interface looks like this :

I have tried several annotation modifications , Finally, I got it right !
Join in @ApiImplicitParams This annotation , It can be solved , The value inside can be modified according to your own parameters !
/**
* Text messaging
* phoneNumbers Mobile number to be sent
* templateParam Variable substitution in templates JSON strand , The template content is " Your verification code is :${code}, Do not disclose to others !"
*/
@GetMapping(value = "/sendSms")
@ApiOperation(value = " Send SMS verification code ")
@ApiImplicitParams({
@ApiImplicitParam(value = " Phone number ", name = "phoneNumbers",required = true,paramType = "query",dataType = "String"),
@ApiImplicitParam(value = " SMS template code ,0: Sign in ,1: register ", name = "templateCode",required = true,paramType = "query",dataType = "String"),
})
public ResponseData sendSms(@RequestParam @NotBlank @Pattern(regexp = "^((13[0-9])|(14[0,1,4-9])|(15[0-3,5-9])|(16[2,5,6,7])|(17[0-8])|(18[0-9])|(19[0-3,5-9]))\\\\d{8}$")
String phoneNumbers, @RequestParam @NotBlank String templateCode) {
log.info("phoneNumbers:{},templateCode:{}",phoneNumbers,templateCode);边栏推荐
猜你喜欢
随机推荐
变量名可以用中文?直接把人干蒙了
作业7.19 顺序表
Numpy - 数组array的构造
¥1-2 例2.2 将两个集合的并集放到线性表中
作业7.15 shell脚本
Publish Yum private server using nexus3 (offline intranet)
[GYCTF2020]Node Game
OverTheWire-Natas
OverTheWire-Bandit
~4.2 ccf 2021-12-1 序列查询
Thymeleaf 笔记
学习 Redis linux 安装Redis
Reverse Integer
PHP介绍
*7-2 CCF 2015-09-2 日期计算
数据预处理
Unable to start debugging on the web server, the web server failed to find the requested resource
Mongodb exploration phase [easy to understand]
[GKCTF 2021]easynode
MongoDB数据库文件的读与写


![[GYCTF2020]Node Game](/img/8d/7e6c2fb2a0359298fbcc1cd8544710.png)






