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

feat: default flat param object #1805

Merged
merged 1 commit into from Aug 20, 2022
Merged

feat: default flat param object #1805

merged 1 commit into from Aug 20, 2022

Conversation

NaccOll
Copy link
Contributor

@NaccOll NaccOll commented Aug 20, 2022

I finished a version of the flattened parameter object, but there are still a few questions

MVC:
The default flattening causes test cases to fail. $ref has been changed to properties type, json cannot match. The fail use cases covered are 4, 13, 26, 71, 82, 93, 117, 140, 142
Other use cases have been successed with defaultFlatParamObject=true

WebFlux:
WebFlux uses a lot of Mono, and the flattening operations are in the core package, I'm not sure whether to separate the flattening operations into mvc and webflux.

In short, the behavior is unchanged from before when defaultFlatParamObject set false (default). the parameter object can be automatically flattened under mvc when defaultFlatParamObject set true, so that the description of the field and whether it is required can be viewed on swagger-ui. But defaultFlatParamObject can not set true in webflux.

@bnasslahsen bnasslahsen merged commit 3ef246d into springdoc:master Aug 20, 2022
bnasslahsen added a commit that referenced this pull request Aug 20, 2022
Charles7c added a commit to Charles7c/continew-admin that referenced this pull request Apr 8, 2023
1.使用 default-flat-param-object 全局设置对象型参数展示形式。此设置是在 springdoc-openapi v1.6.11 版本开始添加的新特性(详情请参阅:springdoc/springdoc-openapi#1805 @ParameterObject,工作量较大。
2.作者在使用上方这个配置时还遇到了一个 Bug,那就是只要在对象型参数前使用了注解,例如:@validated PageQuery pageQuery,这个配置就不会生效了。此问题已在 GitHub 提交了相应 issue(详情请参阅:springdoc/springdoc-openapi#2181 springdoc-openapi 社区某个小伙伴儿已在当前最新发布的 v2.1.0 和 v1.7.0 中修复。
注意:由于当前使用的 Knife4j 版本其内部引入的 springdoc-openapi 相关依赖非最新版本,所以为了解决配置不生效问题,暂时将部分对象型参数移除了 @validated 注解(除了 PageQuery,其他类当前也未实际添加校验,所以直接移除了)。当然如果不想移除的话,也可以从依赖上功夫,即移除 Knife4j 内引入的 springdoc-openapi 相关依赖,然后自行添加 springdoc-openapi 相关依赖并指定最新版本即可。
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

Successfully merging this pull request may close these issues.

None yet

2 participants