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

Correctly resolve nullability from openapi #2627

Closed
Beny406 opened this issue Aug 12, 2021 · 3 comments
Closed

Correctly resolve nullability from openapi #2627

Beny406 opened this issue Aug 12, 2021 · 3 comments
Assignees

Comments

@Beny406
Copy link

Beny406 commented Aug 12, 2021

Currently when using OpenAPI handler nullability in the schema is resolved based on open api spec field required but it should be based on field nullable. More detailed discussion in openapi-to-graphql repo IBM/openapi-to-graphql#359

Difference:
required => field needs to be there
nullable => field can have a value of null

@ardatan
Copy link
Owner

ardatan commented Aug 3, 2022

In GraphQL, we don't have undefined so when someone asks for a field that is not available in the response, GraphQL returns null. So I think it is fine to have non-nullability per required.

But if nullable is true and that field is defined under required, it should be still nullable for GraphQL.
And if nullable is false, it should be nonnullable for GraphQL.

I'll try to create a PR for it.
Thanks for pointing that.

@ardatan ardatan self-assigned this Aug 3, 2022
@ardatan
Copy link
Owner

ardatan commented Aug 3, 2022

When I check the code, it seems to be available in the latest version. Closing this issue for now. Please let us know if it doesn't work as expected on your end.

@FGoessler
Copy link
Contributor

This issue seems to be back. See the issue with more details here: #6560

There is also an open PR that should hopefully fix this: #6561

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