当前位置:网站首页>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);边栏推荐
- What are stand-alone, cluster and distributed?
- Notes on in-depth analysis of C language 1
- 『每日一问』怎么实现一个正确的双重检查锁定
- C#语言和SQL Server数据库技术
- OverTheWire-Natas
- 机器学习 —— Sklearn包中StandardScaler()、transform()、fit()的详细介绍
- 一文搞懂为什么要同时重写equals方法和hashCode方法+实例分析
- uni-app如何获取位置信息(经纬度)
- The interviewer asked: how to prevent oversold? There are several ways to achieve it
- *7-2 CCF 2015-09-2 日期计算
猜你喜欢
随机推荐
@1-1 CCF 2021-04-1 灰度直方图
sqli-labs Basic Challenges Less1-10
In mysql, update and select are used together
数据预处理
TCP网络应用程序开发流程
无法再web服务器上启动调试,web服务器未能找到请求资源
【代码源】每日一题 添加括号
office文件对应的Content-Type类型
MongoDB数据库文件的读与写
在Ubuntu中安装MySQL并创建新用户
前台页面打印
Click to hide the column in wechat applet, and then click to show it
Thick willow dustpan, thin willow bucket, who hates reptile man? Asynchronous synergism, half a second to strip away a novel
[GKCTF 2021]easynode
sqli-labs Basic Challenges Less11-22
『每日一问』ReentrantLock加锁解锁
MySQL排序
~4.1 剑指 Offer 05. 替换空格
MySQL的索引、视图与事务
ActiveMQ -- AMQ of persistent mechanism


![[GYCTF2020]Ez_Express](/img/ce/02b90708f215715bb53cacfd4c21f0.png)





