当前位置:网站首页>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);边栏推荐
- 最短路问题 Bellman-Ford(单源最短路径)(图解)
- ~4.2 ccf 2021-12-1 序列查询
- Numpy - Construction of array
- office文件对应的Content-Type类型
- *6-2 CCF 2015-03-3 节日
- ActiveMQ -- dead letter queue
- 前台页面打印
- Dynamically add multiple tabs and initialize each tab page
- Deep understanding of static keyword
- The difference between abstract classes and interfaces (the most detailed)
猜你喜欢
随机推荐
¥1-1 SWUST oj 941: 有序顺序表的合并操作的实现
The difference between abstract classes and interfaces (the most detailed)
作业7.15 shell脚本
『怎么用』装饰者模式
多态和接口
Thymeleaf 笔记
『每日一问』ReentrantLock加锁解锁
Go foundation 1
Numpy - 数组array的构造
[HCTF 2018]admin
Understand the execution process of try, catch and finally (including return) (the most detailed analysis of the whole network)
*6-1 CCF 2015-03-2 数字排序
[HCTF 2018]admin
保姆级Scanner类使用详解
sqli-labs Basic Challenges Less11-22
【代码源】每日一题 分数拆分
Numpy array attribute, shape changing function, basic operation
数据控制语言(DCL)
Dynamically add multiple tabs and initialize each tab page
卷积神经网络的兴趣简单介绍




![[De1CTF 2019]SSRF Me](/img/12/44c37cc713b49172a10579c9628c94.png)


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

