-
Notifications
You must be signed in to change notification settings - Fork 1.2k
chore: use JSON instead of YAML for openapi generation #4038
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
Conversation
4d6e4b7 to
609904f
Compare
JSON has a few advantages over YAML in this context: * No extra dependency: Removed ruamel.yaml; using the standard library json module. * Simpler code: No YAML formatting configuration (indent, flow style, string presentation, etc.). JSON serialization is straightforward. * Faster generation: JSON serialization is typically faster and more predictable than YAML formatting. * Native OpenAPI format: JSON is the native OpenAPI format. Many tools prefer JSON, reducing potential compatibility issues. * Better tooling support: JSON is widely supported. Tools like oasdiff, OpenAPI validators, and code generators work well with JSON. * Fewer formatting edge cases: YAML can have edge cases (multiline strings, special characters, quoting, scalars etc). JSON avoids these. All the tools consumming the YAMLs have been updated namely oasdiff for conformance tests, docusaurus config and the genrator. Signed-off-by: Sébastien Han <seb@redhat.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
No more YAML processing, the spec is JSON. Signed-off-by: Sébastien Han <seb@redhat.com>
6615e68 to
7ecd015
Compare
|
I really do disagree with this quite a bit. Not only are OpenAPI specs widely available in YAML, YAML tends to be far more readable and consumable than JSON. It is reasonable to say we can produce both. |
Yes, it's more readable / consumable. But in practice, by whom? Who reads it despite stainless or other programming tools? Do humans really look at it? |
|
|
@Mergifyio rebase |
If you feel like YAML is helpful during code review, I'll stop here then :)
It's not the just ruamel.yaml, it's more all the boilerplate code we have in the generator to configure the YAML output. JSON is much easier on that front. Anyways, I can live witht that I guess. |
yes I most definitely look through YAML changes during code review and have spotted issues over time due to this review. |
What does this PR do?
JSON has a few advantages over YAML in this context:
All the tools consumming the YAMLs have been updated namely oasdiff for conformance tests, docusaurus config and the genrator.
Test Plan
CI conformance tests.
This is foundation work to ease #3944 too.