当前位置:网站首页>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);边栏推荐
- Publish Yum private server using nexus3 (offline intranet)
- *7-1 CCF 2015-09-1 数列分段
- @3-2 CCF 2020-12-2 期末预测之最佳阈值
- 作业7.15 shell脚本
- idea中将lib目录下的jar包加入到项目中
- [GKCTF 2021]easynode
- ~5 ccf 2021-12-2 序列查询新解
- [HCTF 2018]admin
- OverTheWire-Natas
- How can technologists start their personal brand? Exclusive teaching of top five KOLs
猜你喜欢

uni-app如何获取位置信息(经纬度)

Idea practical tips --- now change pom.xml (red) to pom.xml (blue)

What are stand-alone, cluster and distributed?

MongoDB数据库文件的读与写

【代码源】每日一题 - 排队

【代码源】每日一题 算的我头都大啦

@3-1 CCF 2020-09-1 称检测点查询

卷积神经网络的兴趣简单介绍
![[De1CTF 2019]SSRF Me](/img/12/44c37cc713b49172a10579c9628c94.png)
[De1CTF 2019]SSRF Me

Unable to start debugging on the web server, the web server failed to find the requested resource
随机推荐
ActiveMQ -- JDBC Journal of persistent mechanism
How can technologists start their personal brand? Exclusive teaching of top five KOLs
Go foundation 3
一文搞懂为什么要同时重写equals方法和hashCode方法+实例分析
Flask SSTI注入学习
Numpy- array属性、改变形状函数、基本运算
PHP介绍
office文件对应的Content-Type类型
CentOS changes MySQL database directory
什么是贫血模型和充血模型?
[WSN communication] optimize HWSN energy-saving clustering protocol based on MATLAB biogeography [including Matlab source code, 1989]
@5-1 CCF 2019-12-1 报数
Click to hide the column in wechat applet, and then click to show it
『每日一问』简单聊聊JMM/说说对JMM的了解
[HCTF 2018]admin
[GKCTF 2021]easynode
作业7.15 shell脚本
PHP网站设计思路
@2-1 CCF 2020-12-01 期末预测之安全指数
ActiveMQ -- dead letter queue