-
Notifications
You must be signed in to change notification settings - Fork 2k
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
oneof: add test case #4034
oneof: add test case #4034
Conversation
✅ Deploy Preview for compassionate-pike-271cb3 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋 Supported commandsPlease post this commands in separate comments and only one per comment:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should throw an error 🤔 based on All Variable Uses Defined
The question is kind of moot because the query is meaningless having a variable reference that's not defined; but yes this should fail the "OneOf Input Objects Have Exactly One Field" validation rule:
If you define the variable |
Have to check back on this |
Sorry @saihaj @benjie => I was out of context on this for a while. I updated the operation to include the variable so it doesn't run afoul of "All Variables Used Defined", and the query fails OneOf validation appropriately whether or not the operation variable is included. But it passes execution without a problem, and the question I am asking is if it should throw an error, i.e. whether this invalid query should still execute or not. I found this discussion, where there seems to have been a request for feedback on this exact issue, without a clear resolution I could find. What the implementation does is let it slide in execution, but from the discussion there it seems like we would have to update the coercion table if that's the choice we make. Not the most live issue, as this is with regards to an invalid query, can certainly wait until after GraphQLConf, hope everyone will enjoy! |
@yaacovCR I believe this is replaced by your newer PRs that mark this as invalid? |
this test currently passes. should it?
At issue is whether oneof coercion should also check the pre-coerced provided value for the correct number of keys. Currently, it doesn't, although it seems that the proposed spec edits suggests that it should, although the discussion on the issue seems open.
[Similarly, we currently also get an error message of incorrect number of keys if a single misspelled key is provided, in addition to the error about the misspelling, and we don't get an incorrect key if an extra key is given if it is misspelled. All of these stem from the same issue, so graphql-js is currently internally consistent].
@benjie @erikkessler1
links:
graphql/graphql-spec#825
link to discussion on this issue