-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Sort parameters by their order before sorting them by their name #2721
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2721 +/- ##
============================================
+ Coverage 94.77% 94.77% +<.01%
- Complexity 3161 3162 +1
============================================
Files 354 354
Lines 8057 8058 +1
Branches 608 608
============================================
+ Hits 7636 7637 +1
Misses 271 271
Partials 150 150
|
+1 |
+1 |
+1 I was able to keep the parameters order just adding this plugin alongside the change of this PR
|
The change in this PR doesn't affect the current 2.9.x behavior (alphabetically sorted) But IMO, the parameter index should be kept and that should be the default behavior. The API spec is used to auto generate code and sorting it alphabetically by default doesn't seem reasonable. |
As a side note, OperationBuilder, ParameterBuilder and similars could be spring components with scope 'prototype' so we could easily override them |
@shartte Can you resolve the conflict? I would also like to keep the defined order instead of sorting parameters alphabetically and am looking forward to see this landing in 3.0. |
Sorry, no, I won't put any more time in. It seems like this PR has no chance of being merged given how long it is open. |
@shartte sorry it took so long. I've resolved the conflicts and merged. |
Thanks for the PR! 🤘 |
Hi, @dilipkrish Will it be released soon? This change is quite usefull INMO. |
@antechrestos yes Im trying to as soon as I can... see #3070 |
looks still broken, I not able forced order instead alphabetical sorting |
Rather than sorting parameters only by their name, sort them by their existing order field first, then use the name as a tiebreaker.
Parameter already implements Ordered, so this seems like a natural way of sorting parameters.
This also enables plugins to apply any custom parameter order they want, while the current sorting prevents that.
Currently parameters all have the initial order value of Integer.MIN_VALUE, so this change should not affect the current ordering without any additional plugins applied.