-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
please user OrderedMap instead of the golang's map #645
Comments
Go maps iteration order is random, so I don't see why you mention deserialization? Are you asking for this lib to use orderedmaps instead of maps so that operations can be deterministic? What's your use case? Also, what implementation of orderedmap would you recommend and why. |
See also https://github.com/wk8/go-ordered-map |
We have noticed that not only is the ordering inconsistent, which can make it a mess for people trying to read the yaml files, but the output yaml will also break a swaggerhub display. By default, yaml is output in alphabetical order. This places 'components' before 'paths' and that will break some definitions. All the definitions are there, and it does validate in swaggerhub BUT the display does not show the definitions. We've seen this so far with 'allOf'
If we manually move the 'components' section to be after 'paths', then all is ok again. |
Thanks for your feedback! We've got a couple github issues related to serialization order (and non-determinism must be annihilated) and I'm happy to hit two birds with one stone! Note: solving this issue depends on wk8/go-ordered-map#14 (comment) if anyone want to help there ;) |
Seems like this is already implemented on wk8/go-ordered-map#16 |
@chippyash Serialization order of fields is already adaptable. See openapi3.go and the MarshalJSON func implementation there. You should be able to reorder the fields there. I'll review your PR (provided you add a test for this ofc) @codestation Look at my draft PR you'll see that's already being used :) |
FYI progress on this is blocked by #763 |
@fenollp Any progress on this please? |
Hi @chippyash Not much progress to report. Still blocked on #763 Comments welcomed! |
The reason I'd like this: we generate our spec file and add it to git, and right now if we use (I'm not expecting anyone to magically fix this, just providing reason for having order preserving.) |
The order of properties after each parsing is inconsistent.
The text was updated successfully, but these errors were encountered: