-
-
Notifications
You must be signed in to change notification settings - Fork 507
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
default-flat-param-object does not take effect #2181
Comments
I haven't been able to reproduce it perfectly, but I have found the code for the bug. https://github.com/springdoc/springdoc-openapi/blob/master/springdoc-openapi-common/src/main/java/org/springdoc/core/DelegatingMethodParameter.java#L130 A simple code is below. @GetMapping("/test1")
public String test1(@Validated Person person) {
return null;
} Since there is no test code in the repository, I don't know why annotations are checked, but since |
Ah ha, I see. I had my doubts but I couldn't believe it. |
1.使用 default-flat-param-object 全局设置对象型参数展示形式。此设置是在 springdoc-openapi v1.6.11 版本开始添加的新特性(详情请参阅:https://github.com/springdoc/springdoc-openapi/pull/1805),在此之前,只能在所有需要处理的对象型参数类上使用 @ParameterObject,工作量较大。 2.作者在使用上方这个配置时还遇到了一个 Bug,那就是只要在对象型参数前使用了注解,例如:@validated PageQuery pageQuery,这个配置就不会生效了。此问题已在 GitHub 提交了相应 issue(详情请参阅:https://github.com/springdoc/springdoc-openapi/issues/2181),并且 springdoc-openapi 社区某个小伙伴儿已在当前最新发布的 v2.1.0 和 v1.7.0 中修复。 注意:由于当前使用的 Knife4j 版本其内部引入的 springdoc-openapi 相关依赖非最新版本,所以为了解决配置不生效问题,暂时将部分对象型参数移除了 @validated 注解(除了 PageQuery,其他类当前也未实际添加校验,所以直接移除了)。当然如果不想移除的话,也可以从依赖上功夫,即移除 Knife4j 内引入的 springdoc-openapi 相关依赖,然后自行添加 springdoc-openapi 相关依赖并指定最新版本即可。
If you ❤️ this project consider becoming a sponsor.
If you already use the
springdoc-openapi
, please do not forget adding a github star to this repository.Describe the bug
I upgraded the springdoc-openapi dependencies from 1.6.9 to 1.6.15, and then I tried to use the new feature
default-flat-pam-object
, but it didn't work after the configuration was complete.To Reproduce
Steps to reproduce the behavior:
What version of spring-boot you are using?
Spring Boot 2.7.10
What modules and versions of springdoc-openapi are you using?
springdoc-openapi 1.6.15
What is the actual and the expected result using OpenAPI Description (yml or json)?
I had to make extensive use of the @ParameterObject annotation before, and I hope that with this configuration I can get rid of this hassle.
Provide with a sample code (HelloController) or Test that reproduces the problem
https://github.com/Charles7c/continew-admin
Screenshots
The text was updated successfully, but these errors were encountered: