-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Support for OpenAPI 3.0 #7
Comments
Good idea. Ill look into this after settling on type interfaces for version 2 |
I'm exploring OpenAPI v3 for some project, and decided to try to implement the spec. It's not complete (it's missing many objects from the spec) but I think it's in a working state. I can deserialize and serialize back to yml a "small" API (<250 lines) with almost no loss, mostly formatting (quotes or not around strings, a I wrote a small dumb bash script to check which objects are missing an struct by comparing with the table of content of the spec. Here's the output:
I'm not sure how to test/validate the code though. The only test in the original crate is a deserialization test on the couple of OpenAPI v3 examples. As with my manual validation above, re-serialization can't really be used to compare with original since ordering and quoting can change. I guess the reference yml files could be split into smaller chunks to test specific structs... I would like to add proper referencing (#12) but for now I use strings. I also have a small check for the API version (#8), but it can only be checked after deserialization. So if one tries to deserialize an unsupported version, it will fail at the deserialization step, not the at the validation. I haven't forked this repo (started a new one instead, not even on github). I though it was easier to start from scratch and add what was required for v3, importing from this repo when it was making sense. As such it could probably be merged back into this repo. Let me know if it could be useful! |
I've actually found a way to solve both the field ordering issue and validating that features are implemented. For this, I do both of these conversions:
Also, missing features will clearly be shown as missing fields in the second string above. |
These are the changes:
https://blog.readme.io/an-example-filled-guide-to-swagger-3-2/
The text was updated successfully, but these errors were encountered: