Hi,我是 八一菜刀,Java工程师,是 Knife4j 的作者,喜欢开源!
⭐️ 个人博客:https://www.xiaominfo.com
⭐️ twitter:https://twitter.com/xiaoymin
- TorchV Bot开放试用中
- 正在学习大模型,RAG、langchain、LlamaIndex等方面的技术
- 正在筹备Knife4j 5.0版本的发布
Knife4j is a set of Swagger2 and OpenAPI3 All-in-one enhancement solution
Home Page: https://doc.xiaominfo.com
License: Apache License 2.0
Hi,我是 八一菜刀,Java工程师,是 Knife4j 的作者,喜欢开源!
⭐️ 个人博客:https://www.xiaominfo.com
⭐️ twitter:https://twitter.com/xiaoymin
@requestbody注解时,请求参数最外层的哪个类型(即@requestbody所标注的参数类型)没有必要要把,误导前端
在返回值有循环关联里会堆栈溢出.
关联关系如: A下有个集合属性,类型为B. B下也有集合属性,类型为A.
Uncaught RangeError: Maximum call stack size exceeded at Array.indexOf (<anonymous>) at Function.inArray (jquery-1.9.1.min.js:2) at checkIsBasicType (DApiUI.js:1475) at findRefDefinition (DApiUI.js:1518) at findRefDefinition (DApiUI.js:1531) at findRefDefinition (DApiUI.js:1531) at findRefDefinition (DApiUI.js:1531) at findRefDefinition (DApiUI.js:1531) at findRefDefinition (DApiUI.js:1531)
swagger-ui.html是这样的
{
"token": "string",
"userInfo": {
"email": "string",
"emailBinding": "string",
"encryMode": "string",
"faviconFileId": "string",
"id": 0,
"identityFileId": "string",
"identityNum": "string",
"identityType": "string",
"isDeleted": "string",
"mobile": "string",
"mobileBinding": "string",
"nickname": "string",
"oldId": 0,
"oldusername": "string",
"orgCode": "string",
"orgCodes": "string",
"orgId": 0,
"orgIds": "string",
"orgName": "string",
"password": "string",
"salt": "string",
"sex": "string",
"sysCode": "string",
"tel": "string",
"trueName": "string",
"trueNameEn": "string",
"username": "string",
"verifyStatus": "string"
}
}
Swagger-Bootstrap-UI是这样的:
{
"token":"",
"userInfo":""//这是一个对象,里面的属性就出不来了
}
在传输对象中,如果是枚举类的话,列出枚举列表或者提示
有些特殊的情况,如需要在Headers加入Token,需要自定义Headers的内容,希望可以加入此功能。
就是上传的MultipartFile对象会被识别成表单String参数,能否修改一下
如果返回值时带泛型的参数时,响应状态码显示处解析实体类的字段属性少了引号,js的json.parse会解析出错。
![Uploading 0OMAFQ]B@XDDN@N%%[email protected]…]()
参数类型展示:
consumes ["multipart/form-data"] => 参数类型错误展示为 query
consumes ["application/x-www-form-urlencoded"] => 参数类型错误展示为 formData
在线调试
参数类型为 formData 的参数,填写了参数值还是提示 参数不能为空
可以参考spingfox-swagger-ui的效果。
controller层实体类接收参数,发送请求时,默认实体类所有字段都是选中的,选中的参数如果不填写,默认会发送空的字符串到后台,影响查询结果。现在只能手动把不需要的参数都手动去掉勾选,比较繁琐,建议不填写的字段不要传值。
Originally posted by @lwydyby in https://github.com/xiaoymin/Swagger-Bootstrap-UI/issue_comments#issuecomment-430953326
版本:1.8.4
1、https 的文档地址,在线调试的时候变成了 http;
2、dataTypeClass = BigDecimal.class ,生成文档变成了 string;
3、paramType = "query" ,生成的文档显示 consumes ["application/json"]
希望新版能修复以上几个问题
单文件和多文件上传 不支持吗?
我有个两个建议,
1: 你的文档界面右边的滚动条能正常使用,为什么debug界面,右边滚动条要禁用呢?如果我调试时返回的json较长,查看起来超级不方便,每次我都要把返回的json复制出来用记事本查看,麻烦死了。如果不禁用滚动条,且下面的结果区域能自己调大小,就方便多了
2:有办法支持拓展mock功能吗?
原生的swagger, 只需要在接口注解上配置 produces = "application/octet-stream" 就可以测试文件下载.
不知道swagger-bootstrap-ui 要怎么配置才能实现这个测试功能?
接口返回值类型为boolean时,接口文档中返回值类型和示例的部分内容为空,猜想非引用类型可能都会出现这种情况。而官方的swagger-ui 2.x版本能显示返回值为 boolean 类型。
版本:
swagger: 2.8.0
swagger-bootstrap-ui: 1.7.9
使用中出现了将Query参数以Form形式发送出去的情况
参数列表是否必录,要明显一点或者换一个颜色的字体,醒目一点,不然多了不好找
swagger-ui.html是这样的
{
"token": "string",
"userInfo": {
"email": "string",
"emailBinding": "string",
"encryMode": "string",
"faviconFileId": "string",
"id": 0,
"identityFileId": "string",
"identityNum": "string",
"identityType": "string",
"isDeleted": "string",
"mobile": "string",
"mobileBinding": "string",
"nickname": "string",
"oldId": 0,
"oldusername": "string",
"orgCode": "string",
"orgCodes": "string",
"orgId": 0,
"orgIds": "string",
"orgName": "string",
"password": "string",
"salt": "string",
"sex": "string",
"sysCode": "string",
"tel": "string",
"trueName": "string",
"trueNameEn": "string",
"username": "string",
"verifyStatus": "string"
}
}
Swagger-Bootstrap-UI是这样的:
{
"token":"",
"userInfo":""//这是一个对象,里面的属性就出不来了
}
问题一:
比如
POST的时候不需要id属性
PUT的时候必须有id属性
问题二:
我设置了consumes=multipart/form-data
为什么还是不能multipart/form-data方式提交
tips:另外中文文档中的maven包版本没有更新,太老了
delete请求会将请求头放在url参数中
1 左边导航栏繁杂,内容太多了,没有1.5的清晰
2 响应model中无法识别嵌套对象
3 建议响应参数说明的顺序和输入参数说明的顺序一致
使用版本1.8.7
案例:
{
"get": {
"summary": "第一个list功能",
"deprecated": false,
"produces": [
"*/*"
],
"operationId": "list3GET4997028859787988992",
"responses": {
"200": {
"schema": {
"type": "object",
"properties": {
"id": {
"name": "id",
"in": "formData",
"description": "标识的desc",
"required": true,
"type": "string"
},
"createTime": {
"name": "createTime",
"in": "formData",
"description": "时间的desc",
"required": false,
"type": "string"
}
}
},
"description": "返回profile列表"
}
},
"description": "list的description",
"parameters": [
{
"name": "id",
"in": "formData",
"description": "标识的desc",
"required": true,
"type": "string"
},
{
"name": "createTime",
"in": "formData",
"description": "时间的desc",
"required": false,
"type": "string"
}
],
"tags": [
"profile"
],
"consumes": [
"application/xml"
]
}
}
在responses里面的schema不能正确的展示。 该问题在springfox-swagger-ui等其他工具上可以正确展示。如果schema内容为$ref指到definitions内的元素,展示没有问题。
目前的情况,好像是设置了position,@ApiSort就无效了。
我的预期是,当position相同的情况下,再按@ApiSort进行排序。
在实际应用中,可能几个API属于同一大类的,该大类使用position进行排序。
然后大类中的API根据@ApiSort进行内部排序。
或者加一个API分组的功能也不错(组名,排序)
例如:
1.一个投票APP有系统管理,和投票管理两个大类
2.系统管理中,又分为用户对象、角色对象、权限对象等等
3.用户对象又分为增删改查的接口
在SpringMVC中对应的具体控制器名类似:
一、
1.UsersController
2.RolesController
二、
1.VoteSubjectsController(投票主体管理)
2.VoteResultsController(投票结果管理)
查看swagger发送的请求发现,请求头的Content-Type一直为application/json,且设定全局参数后也无法对其进行修改,导致controller无法接收到参数
使用groupName分组后就不能生成文档了,这是怎么回事?
I hope provide SpringBoot2.X Demo Project。
1、request mapping 中地址不支持path参数,只支持value,可否增加path参数的支持?
2、请求参数为实体类对象时,如果实体类中有验证注解,可否增加对JSR-303 annotations 注解的支持
@ApiModelProperty注解里面不管设置required是true,还是false,生成出来doc页面,是否必须这一列总是true。
Uncaught SyntaxError: Invalid regular expression: /#/definitions/(.*)$/: Stack overflow
at RegExp.test ()
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1470)
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1476)
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1476)
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1476)
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1476)
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1476)
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1476)
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1476)
at SwaggerBootstrapUi.findRefDefinition (swaggerbootstrapui.js:1476)
当定义一个全局的header数据的时候,在接口中定义接收时,改参数会重复显示
@xiaoymin
希望能够个性化host,port,/swagger-resources和/v2/api-docs的地址。
这样可以根据外部传入的参数,让一套ui程序,适应多个后台的文档。
模型内部包含有多种子模型,子模型下的内部模型没有展示
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.