Fix customizer ordering - #3330
Conversation
Signed-off-by: king-407 <95581750+king-407@users.noreply.github.com>
Fixes springdoc#3320 Signed-off-by: king-407 <95581750+king-407@users.noreply.github.com>
Signed-off-by: king-407 <95581750+king-407@users.noreply.github.com>
|
@king-407 Thank you for your help! Much appreciated 🙏 However, there is one thing I don't quite understand: why was the existing custom item collection API retained? I noticed that most of the places where it was used have also been modified, and it seems that using (I prefer using I'm curious—is this due to compatibility concerns, or is there another reason? |
|
@zhujianxintian Thanks for taking a look. Yes, the main reason was to keep the change narrow and avoid changing the existing
That said, I agree that |
|
Thank you for your reply, I understand the reason for doing this now. Both I raised this question only because I wanted to improve readability further, but perhaps the latter is indeed more prudent at the moment. Both ways are good. Thank you for your contribution. |
Summary
Fixes #3320.
This updates Springdoc customizer execution so customizers are applied according to Spring ordering semantics such as
@Order.Previously, several customizer collections were stored as
Sets and iterated directly, so the execution order could depend on set iteration order instead of Spring's ordering rules.Changes
OpenApiCustomizerinstances in Spring order.OperationCustomizerinstances in Spring order.RouterOperationCustomizerinstances in Spring order.DataRestRouterOperationCustomizerinstances in Spring order.OpenApiLocaleCustomizerbeans using Spring's ordered bean stream.Testing
mvn -q -pl springdoc-openapi-starter-common -Dtest=SpringDocCustomizersTest test git diff --check