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

oneof: add test case #4034

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Mar 27, 2024

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
graphql/graphql-spec#825
graphql/graphql-spec#825

Copy link

netlify bot commented Mar 27, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit b9f3333
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/6604043c9d1c940008910a02
😎 Deploy Preview https://deploy-preview-4034--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

Copy link
Member

@saihaj saihaj left a 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

@benjie
Copy link
Member

benjie commented Apr 3, 2024

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:

- Let {fields} be the fields provided by {oneofInputObject}.
- {fields} must contain exactly one entry.

If you define the variable $b, does the issue go away?

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

3 participants