Skip to content
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

OpenApi 3.1.0 #58

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Conversation

rrichardson
Copy link

@rrichardson rrichardson commented May 24, 2022

This continues the work from #55

There are some additional changes:

  • Adds conversion for all types using From<v3_0> for v3_1
  • Restores the default as version 3.0 - so no break in compatibility
  • Puts the Version switch under a module named versioned (need a better name)
  • Aligns struct naming with Rust Conventions (no consecutive capital letters, e.g. Http instead of HTTP) (in 3.1 only)
  • Removes Option as that is a bit redundant (in 3.1 only)
  • Clippy 100% approves (modulo some large_enum_variant allowances)
  • Makes tests work with new scheme.

JamesHinshelwood and others added 11 commits February 12, 2022 10:15
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
Co-authored-by: James Hinshelwood <james.hinshelwood@bigpayme.com>
@tamasfe
Copy link

tamasfe commented Sep 5, 2022

Is there ETA on this, what can I do to help driving it forward?

I have a tool that uses schemars for schema generation but with own type definitions. It would be great to transition to this instead.

@ahl
Copy link
Collaborator

ahl commented Sep 8, 2022

@tamasfe I'm increasingly of the opinion that using schemars is not going to the approach here. That crate is just too sporadically maintained and too resistant to offers of help to be a safe choice.

@tamasfe
Copy link

tamasfe commented Sep 8, 2022

I see, thanks. That's unfortunate, it's currently the best schema generator library and having its schema types among the openapi types has been very convenient for me.

@ahl
Copy link
Collaborator

ahl commented Sep 9, 2022

Totally! It would be great if it were being diligently maintained.

yoav-lavi pushed a commit to grafbase/grafbase that referenced this pull request Sep 5, 2023
This PR adds support for OpenAPI 3.1 to the OpenAPI connector.  

Despite the name, 3.1 is a breaking change from 3.0. The primary change
is that schemas are now JSON schema, rather than some bizarre "subset
superset" . There's no currently released crate that has support for
OpenAPI 3.1, but there is a fork of our existing openapiv3 library that
adds support. I've forked that fork into the `grafbase` org for now - it
was behind on a couple of patches so I've merged those in. There is [a
PR to merge this back into the actual
crate](glademiller/openapiv3#58) but it looks
kind of like that'll never be merged. Guess we might want to revisit
when/if there's an actual release with support.

Anyway, unfortunately this version of the crate has made some choices
around how to structure schemas that are _completely_ different from the
v3 approach (a common OpenAPI problem - if there is a different way to
do things you can guarantee someone has). So this required a fair bit of
new code - similar to adding v2 I've just added another folder in
`parsing` that takes v3.1 and puts it onto the same intermediate graph
as the other versions use. Then the rest of the code can be shared.

### Testing

- Orb spec seems to work, there's a test in this PR.
- The Mongo Atlas API is also 3.1, but it doesn't work yet - it's doing
some things that break some of my assumptions, so will need to do a
follow up PR to fix that.
- If anyone knows of other 3.1 specs I could test with please shout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants