Comments (3)
好的,感谢反馈
from knife4j.
第三个,paramsType="query"的显示这个应该是swagger给出的application/json
ui这边应该没有处理的
from knife4j.
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
}
}
from knife4j.
Related Issues (20)
- 求救,升级springboot3后多个对象识别为arg0、arg1 HOT 1
- 什么时候升级ClassGraph,io.github.classgraph版本低 HOT 1
- knife4j UI 不支持swagger3 @RequestBody注解支持, 原生ui支持 HOT 1
- favicon.ico 404 Not Found HOT 3
- AfterScript 添加多个header好像被覆盖了
- knife4j页面地址自动携带的#井号 (特殊字符)无法通过spring-security的放行规则,导致页面无法访问, HOT 1
- 关于SpringBoot2.7.18升级到3.2.x后的Knife4j使用的系列问题汇总(已全部解决) HOT 14
- 使用文档下载文件报错,使用apifox、postman可以正常下载 HOT 2
- 范型映射类型不正确
- @ApiModel 显示错误,显示成其他类,@ApiModel 如何确认唯一性?
- @ApiModel value 长度限制? HOT 1
- spring doc升级到2.4.0及以后的版本,group-configs异常 HOT 5
- @ApiImplicitParam的allowableValues属性,在@Parameter如何对应,能否提供样例
- 当使用注解时出现未知的描述 HOT 4
- 这个应该你自己查查原因
- 当knife4j-gateway-spring-boot-starter聚合基于dubbo的微服务时 访问v3/api-doc出错 HOT 1
- knife4j文档请求异常 HOT 2
- springboot3整合时swagger可以访问,knife4j页面无法访问
- 导出word格式接口文档,word格式错乱 HOT 1
- 对于@Parameter @ModelAttribute @Valid共同注解所获取的数据,在请求时请求数据格式存在问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knife4j.