-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https以及consumes ["application/json"]的bug #33
Labels
Comments
好的,感谢反馈 |
第三个,paramsType="query"的显示这个应该是swagger给出的application/json ui这边应该没有处理的 |
https的应该是构建curl的功能吧?文档中只有该处我是写死的,发送时没有使用绝对地址 关于第二点,dataTypeClass = BigDecimal.class ,生成文档变成了 string;我测试了下: 代码: @ApiOperation(value = "BigDecimal类型->String类型",position = 2)
@PostMapping("/dataBigDeciaml1")
@ApiImplicitParam(name = "bigDecimal",dataTypeClass = BigDecimal.class,value = "工资",required = true)
public Rest<BigDecimal> dataBigDeciaml1(BigDecimal bigDecimal){
Rest<BigDecimal> r=new Rest<>();
r.setData(bigDecimal);
return r;
} 最终查看swagger生成的json文件结构如下: {
"post": {
"tags": [
"1.8.5版本-20180925"
],
"summary": "BigDecimal类型->String类型",
"operationId": "dataBigDeciaml1UsingPOST",
"consumes": [
"application/json"
],
"produces": [
"*/*"
],
"parameters": [
{
"name": "bigDecimal",
"in": "query",
"description": "工资",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Rest«bigdecimal»"
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"BearerToken": [
"global"
]
},
{
"BearerToken1": [
"global"
]
}
],
"deprecated": false
}
}
从结构中,swagger给出的BigDecimal类型是string,还有consumes ["application/json"],所以UI显示的也是如此 如果用下面Java方法类测试: @ApiOperation(value = "BigDecimal类型解析为String类型",position = 1)
@GetMapping("/dataBigDeciaml")
public Rest<Model1851> dataBigDeciaml(@RequestBody Model1851 model1851){
Rest<Model1851> r=new Rest<>();
r.setData(model1851);
return r;
} Model1851 类包含BigDecimal类型 public class Model1851 {
private BigDecimal total;
private String name;
//getter and setter....
} 生成的BigDecimal是Number类型. Swagger的json结构如下: {
"get": {
"tags": [
"1.8.5版本-20180925"
],
"summary": "BigDecimal类型解析为String类型",
"operationId": "dataBigDeciamlUsingGET",
"produces": [
"*/*"
],
"parameters": [
{
"in": "body",
"name": "model1851",
"description": "model1851",
"required": true,
"schema": {
"$ref": "#/definitions/Model1851"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Rest«Model1851»"
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"BearerToken": [
"global"
]
},
{
"BearerToken1": [
"global"
]
}
],
"deprecated": false
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
版本:1.8.4
1、https 的文档地址,在线调试的时候变成了 http;
2、dataTypeClass = BigDecimal.class ,生成文档变成了 string;
3、paramType = "query" ,生成的文档显示 consumes ["application/json"]
希望新版能修复以上几个问题
The text was updated successfully, but these errors were encountered: