-
Notifications
You must be signed in to change notification settings - Fork 211
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
use nullable
OpenAPI property to determine nullability
#360
base: master
Are you sure you want to change the base?
Conversation
Thanks for filing the issue and the pull request! This looks good to me! Can you also sign off your commits?
In addition to this, we will also need to add some test cases and fix all the old ones. I can take a crack at this if you do not have the time. Just let me know! |
Oh sure I'll sign off on them from my work machine tomorrow. I probably won't have the time to update the test cases in the next few days, this patch has unblocked some pressing work I'm perusing. I'd appreciate the help with the test suite. |
There I believe those are now signed off. Apologies for the delay. |
e600a79
to
db4fac6
Compare
…ility Signed-off-by: Nils Lundquist <[email protected]>
Signed-off-by: Nils Lundquist <[email protected]>
Signed-off-by: Nils Lundquist <[email protected]>
Signed-off-by: Nils Lundquist <[email protected]>
Signed-off-by: Nils Lundquist <[email protected]>
db4fac6
to
563afe4
Compare
After doing some more research, I wonder if the proposed change is too simple. I'm still new to the conversation but it seems that historically, there seems to be a lot of debate over how nullability should be conveyed, either using Another one of my concerns stems from the fact that the OAS by default assumes that Arguably, it will be much easier and more functional if we just assume all fields to be nullable. I was thinking we can check if In any case, I am proposing that we remove the |
This is a result of the replacing the prior "it's pretty much JSONSchema" schema language with full-fat JSONSchema. I'm adverse to the idea of not handling this according to the spec. IMO nullability is important to model as accurately as possible. In my use case for example the generated schema is used to provide documentation to users via GraphQL Playground & GraphQL Voyager. I wouldn't want consumers of my API handling nulls everywhere thinking that every field is actually nullable. Granted, my use case is pretty different than the typical user of this package, I'm not using the openapi-to-graphql server just the schema generator (though I do more with it than just documentation). Aside from that, making every field nullable allows users to hit APIs with invalid null fields rather than catching them during the GQL mutation validation. Not the end of the world, but notable. I wouldn't want to make this opt-in by explicitly setting Can you link to a public example of an organization who's not using If there's no other reasonable way, than I'd support making this behavior opt-in via a boolean option passed to openapi-to-graphql. |
@nlundquist You make a lot of convincing points.
I was originally concerned because a lot of the tests are now currently broken but after some careful inspection, I believe that these are errors with the example OASs that I created, which I blame on my own inexperience. To verify that OtG can still successfully wrap the vast majority of OASs in GraphQL, I reran the APIs.guru evaluation. Here are my findings... Current behavior:
Proposed non-nullable behavior:
So it seems that we are still able to successfully wrap the same number of OASs from the wild. There are differences in the warnings but I wouldn't read into them too much because this PR needs to be rebased (for example, you fixed the This makes me more confident that this is a change that we can accept but I am still wary about some its implications, for example with input object types. I've asked my colleague @ErikWittern to give his opinion on it. I'd like to hear his opinions before moving further with this PR. If we feel that my concerns do hold some water, then I think we should add this as an opt-in option as your suggested or wrap it along with the |
Okay, I've heard back from @ErikWittern and we're going to go through with this change. I still need to make a lot of changes to the tests so this will take some time. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
13 similar comments
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Why am I being harassed to keep a branch current that a maintainer has said he would be need revisit? |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
3 similar comments
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@nlundquist Sorry for the spam. I do not know why this is happening either. I have reached out to a number of people to ask them to stop the ibm-ci-bot spam and I am currently waiting for them to get back to me. If it is easier, I can make a copy of your branch and perhaps you will stop getting spammed. |
@nlundquist: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Basic attempt at using nullable instead of
required
to determine nullability. Fixes #359My use case only deals with querying data so I removed required, however it may be still relevant when creating input/mutation types.