当前位置:网站首页>Swagger2显示get接口有问题,加注解就能解决
Swagger2显示get接口有问题,加注解就能解决
2022-07-25 09:20:00 【只想搞钱的程序媛】
代码接入swagger后,运行成功,但get接口一直显示的参数在body,这并不符合

正常swagger会显得的get接口长这样:

尝试过好几次注解修改,终于试对了!
加入@ApiImplicitParams这个注解,就可以解决啦,里面的值根据自己的参数情况修改喔!
/**
* 短信发送
* phoneNumbers 待发送手机号
* templateParam 模板中的变量替换JSON串,模板内容为"您的验证码为:${code},请勿泄露于他人!"
*/
@GetMapping(value = "/sendSms")
@ApiOperation(value = "发送短信验证码")
@ApiImplicitParams({
@ApiImplicitParam(value = "電話號碼", name = "phoneNumbers",required = true,paramType = "query",dataType = "String"),
@ApiImplicitParam(value = "短信模板編碼,0:登录,1:注册", 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);边栏推荐
猜你喜欢

Activemq-- delayed delivery and scheduled delivery

¥1-1 SWUST oj 941: 有序顺序表的合并操作的实现

什么是单机、集群与分布式?

数据控制语言(DCL)

保姆级Scanner类使用详解

『每日一问』简单聊聊JMM/说说对JMM的了解

Detailed explanation of the use of nanny scanner class
![[GYCTF2020]Node Game](/img/8d/7e6c2fb2a0359298fbcc1cd8544710.png)
[GYCTF2020]Node Game

ActiveMQ -- message retry mechanism

Idea practical tips --- now change pom.xml (red) to pom.xml (blue)
随机推荐
Thick willow dustpan, thin willow bucket, who hates reptile man? Asynchronous synergism, half a second to strip away a novel
Redis数据库基础
~1 ccf 2022-06-2 寻宝!大冒险!
【代码源】每日一题 国家铁路
Idea hot deployment
Go foundation 4
Notes on in-depth analysis of C language 2
~4.1 剑指 Offer 05. 替换空格
基本的网络知识
Understand why we should rewrite the equals method and hashcode method at the same time + example analysis
数据库操作语言(DML)
SSM高级整合
MySQL takes the query result as the data updated by update, and concatenates it after the original field data (Lej)
< T> Generic method demonstration
ActiveMQ -- AMQ of persistent mechanism
神经网络方法——美国波士顿房价(回归问题)
registration status: 204
[HCTF 2018]admin
Understand the execution process of try, catch and finally (including return) (the most detailed analysis of the whole network)
What is anemia model and congestion model?