-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
openapi3: ensure YAML marshalling matches JSON's #943
openapi3: ensure YAML marshalling matches JSON's #943
Conversation
Hi! Thanks for submitting this. Should we be thinking of a regression test? |
@fenollp Certainly, I'll rebase my PR. |
Such tests already exist, I was just wondering if you'd thought of something new. No worries, let's just rebase :) |
I did a rebase here, and fixed a few issues, but I've now got tests that are failing because the properties are serialized in a different order. |
I believe you forgot to push your rebase? On keys ordering: theoretically order doesn't matter. Now, we have users requesting certain orderings: "as written", "alphabetical" and custom. |
82e3fb7
to
399bf50
Compare
There's quite a number of tests that are failing due to these changes. If this is something that interests you, I can continue on with that work in a separate PR, to at least provide a foundation / exploration of how that ordered marshalling / unmarshalling might look. |
034224a
to
319ab87
Compare
Cool! I have one myself you can pull from if you'd like: #695 But hm I'll try to merge this one first. Maybe for now we can just sort the fields, so that only YAML marshaling sees ordering changes. Did I get that right? |
for all types.
319ab87
to
fb29602
Compare
Okay, sorry for all the pushes, but I think I've fixed the tests and the PR build checks now. |
Thanks for this! |
I noticed that some types used
MarshalYAML
as the source of truth forMarshalJSON
, but others didn't.Some of those were out of sync, especially with regards to the serialization of extensions.
This PR updates all the
MarshalJSON
functions to call theMarshalYAML
one, with the result that both JSON and YAML marshalling should result in the same value being written.