-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 query parameters generated from object #681
Conversation
Changes to be done. |
i think use order tag would be better than field name |
@foxluqi Indeed! However currently the order of the tag is lost after being inserted to the hashmap.. I don't have ideas how to do it. |
fix code checking error and fix swaggo#717
Codecov Report
@@ Coverage Diff @@
## master #681 +/- ##
==========================================
+ Coverage 84.77% 84.85% +0.08%
==========================================
Files 7 7
Lines 1859 1869 +10
==========================================
+ Hits 1576 1586 +10
Misses 177 177
Partials 106 106
Continue to review full report at Codecov.
|
i think the tag information can be read from schema.Properties? |
@foxluqi @breeswish refer to go-openapi/spec#116 and go-openapi/spec#117 |
Describe the PR
Currently swag may generate arbitrary order parameters when parameters come from query & object, like:
This results in different swagger spec being generated each time even if source code is not modified. Additionally, some openapi client generators like typescript-axios generates each query parameter as function parameters, like:
Thus, unstable parameter order in the specification file will cause code failed to compile at all.
This PR makes parameter order stable by sorting them before output.
Relation issue
Additional context