Skip to content

feature request: handle inconsistent/incompatible schema #248

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

Closed
tirumaraiselvan opened this issue Sep 17, 2019 · 5 comments
Closed

feature request: handle inconsistent/incompatible schema #248

tirumaraiselvan opened this issue Sep 17, 2019 · 5 comments

Comments

@tirumaraiselvan
Copy link

Since there are lot of constructs in OpenAPI that do not map well to GraphQL like anyOf, allOf etc, openapi-to-graphql fails to launch on such schemas.

Instead of failing to launch, is it possible to "drop" parts of the schema which cannot be resolved and throw warnings that these parts are dropped. This can be enabled through a flag like --drop-incompatible-schema or something.

This will allow users with schemas like Stripe etc to get access to many APIs in GraphQL which might be enough for their use-case.

@Alan-Cha
Copy link
Collaborator

@tirumaraiselvan Thanks for the suggestion! I think you make some fair points.

I can see two possibilities right now. As we are translating each operation, if we encounter a schema that we cannot process, we can 1) simply skip the operation or 2) default to GraphQL JSON type and treat the schema and the field like a black box. The first option should be a lot easier the implement than the second option. The second option involves trying to coordinate between the schema and the resolver builders.

What are your thoughts?


I'm sorry I still haven't finished anyOf, oneOf, and not support yet. I know it's been an open issue for quite a while now. I've just been so busy with other work.

@tirumaraiselvan
Copy link
Author

tirumaraiselvan commented Sep 18, 2019

I was thinking of the first. I am not sure I understand the full implications of second.

Also this kind of logic can extend to resolving "inconsistent openapi schemas", say something which has missing/bad definition etc but that's not the most imp use-case IMO.

@tirumaraiselvan tirumaraiselvan changed the title feature request: handle inconsistent schema feature request: handle inconsistent/incompatible schema Sep 18, 2019
Alan-Cha added a commit to Alan-Cha/oasgraph that referenced this issue Oct 3, 2019
Alan-Cha added a commit that referenced this issue Oct 3, 2019
@kargalskaya
Copy link

any progress? I got same issue, UnhandledPromiseRejectionWarning with "oneOf"

@Alan-Cha
Copy link
Collaborator

@kargalskaya I'm making slow progress on my branch (it's also messy because I'm trying out different things) but still a work in progress.

Would love if people wanted to help out on the effort as there are a lot of people who are interested in the fix but it's still quite a complex problem so I wouldn't be sure how to organize it.

@Alan-Cha
Copy link
Collaborator

@tirumaraiselvan @kargalskaya We finally have a fix for this problem! Update to v2.0.0 and take a look at this post!

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

No branches or pull requests

3 participants