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 validation test case #3569

Closed

Conversation

jbellenger
Copy link
Contributor

This is a test case illustrating a validation issue with OneOf types.

The issue is that OneOf validation (and maybe other input validations?) are driven by calls to DataFetchingEnvironment.getArgument. If a data fetcher does not call getArgument, getArguments, or accesses arguments via other means, then validations don't run.

This is counter to section 6.11 of the graphql spec:

only requests which pass all validation rules should be executed. If validation errors are known, they should be reported in the list of “errors” in the response and the request must fail without execution

@bbakerman
Copy link
Member

This is an interesting one - we lazily access arguments to make the system more performant - if a DF never works on the arguments then why do the work to coerce them is the thinking

This is also why we don't look ahead and coerce values until a field is hit. Maybe a parent field will return null and that child field will never executed.

It's in the coercing code that we check OneOf because its then we have the data to check. We cant do it earlier in a general sense because rhe values cna come from variables and so on. (grpahql-js also does this check later after actual validation - I dont know if they have our lazy args problem however)

@bbakerman
Copy link
Member

covered in the other PRs

@bbakerman bbakerman closed this May 21, 2024
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

2 participants