当前位置:网站首页>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);边栏推荐
猜你喜欢
随机推荐
[De1CTF 2019]SSRF Me
~4.1 剑指 Offer 05. 替换空格
Reverse Integer
MySQL takes the query result as the data updated by update, and concatenates it after the original field data (Lej)
Interviewer: tell me the difference between redis and mongodb? [easy to understand]
数据控制语言(DCL)
Click to hide the column in wechat applet, and then click to show it
微信小程序中的列点击隐藏,再点击显示
Notes on in-depth analysis of C language 1
redis的五种数据结构原理分析
~4.2 ccf 2021-12-1 序列查询
¥1-1 SWUST oj 941: 有序顺序表的合并操作的实现
Understand the execution process of try, catch and finally (including return) (the most detailed analysis of the whole network)
卷积神经网络的兴趣简单介绍
【代码源】每日一题 分割(nlogn&n解法)
uni-app如何获取位置信息(经纬度)
~5 ccf 2021-12-2 序列查询新解
Go基础3
对象数据如何转化成数组
*6-3 节约小能手








