Skip to content
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

关于SpringBoot2.7.18升级到3.2.x后的Knife4j使用的系列问题汇总 #775

Open
jmszwzr opened this issue Apr 16, 2024 · 3 comments

Comments

@jmszwzr
Copy link

jmszwzr commented Apr 16, 2024

升级SpringBoot为3.2.4后,同步升级Knife4j到4.5.0后的系列问题如下

1、分组名称不支持中文名称[影响指数:4/5]
2、使用@tag中order字段对控制器排序不生效[影响指数:5/5]
3、无法定义全局错误码信息[影响指数:5/5]
4、控制器层返回数据为xml(目前可解决,解决方式不完美)[影响指数:4/5]
5、新版Knife4j文件上传如何通过注解设置接口参数[影响指数:5/5]

详细问题描述、代码设置及截图等请参见pdf文档:SpringBoot2.7.18升级至3.2.x后的Knife4j的系列问题-v1.0.pdf

如作者有时间,请帮忙看下,不胜感谢!
(2024-04-16 原本想通过在Github附图的二维码加群,发现群在4.14已过期,无法才在Github上提Issues,第一次提,如有不当之处,请指正,感谢!)

@xiaoymin
Copy link
Owner

感谢反馈,我后面有空看一下

ps:其实通过issues反馈交流更好:)

@jamesxujoy
Copy link

文件可以通过这种方式的注解去配置:@parameter(name = "file", description = "文件", required = true, content = @content(mediaType = MediaType.APPLICATION_OCTET_STREAM_VALUE, schema = @Schema(type = "string", format = "binary"))),我试过是可以的。
但问题是如果文件字段是在某个实体类里,这个实体类作为controller方法的参数,那swagger不返回这个文件字段,前端也无法显示。

@jmszwzr
Copy link
Author

jmszwzr commented May 25, 2024

@jamesxujoy 你用的也是knife4j-openapi3-jakarta-spring-boot-starter4.5.0的版本么?我本地用你这么配置之后,在doc.html打开中还是不能上传文件,有点囧...以下是本地贴图
1.业务代码(knife4j-openapi3-jakarta-spring-boot-starter 4.5.0实现方式)
01

2.前端访问(knife4j-openapi3-jakarta-spring-boot-starter 4.5.0实现方式)
02

PS:
旧版knife4j-spring-boot-starter 3.0.3(升级前的前端正常访问)
03
旧版knife4j-spring-boot-starter 3.0.3(后端配置)
04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants