Enforce Oneof behavior at execution time#3
Open
erikkessler1 wants to merge 3 commits intooneof-validationfrom
Open
Enforce Oneof behavior at execution time#3erikkessler1 wants to merge 3 commits intooneof-validationfrom
erikkessler1 wants to merge 3 commits intooneof-validationfrom
Conversation
jturkel
reviewed
Jan 21, 2022
| describe('Execute: Handles Oneof Input Objects and Oneof Objects', () => { | ||
| describe('Oneof Input Objects', () => { | ||
| const rootValue = { | ||
| test() { |
There was a problem hiding this comment.
Should these tests echo back the oneOf input object argument rather than returning a hard coded literal to ensure the inputs make it all the way through the resolvers?
| }, | ||
| }; | ||
|
|
||
| it('accepts a good default value', () => { |
There was a problem hiding this comment.
Do we also need test coverage for field argument defaults and input object input field defaults that use oneOf input objects?
EDIT: I guess the validation for those scenarios is still pending based on graphql#3049.
| ); | ||
| expectValueFrom('{ requiredBool: null }', testInputObj).to.equal(undefined); | ||
| expectValueFrom('{ bool: true }', testInputObj).to.equal(undefined); | ||
| expectValueFrom('{ a: "abc" }', testOneOfInputObj).to.deep.equal({ |
There was a problem hiding this comment.
Is it worth testing a oneOf input object with one key that has a value that can't be coerced e.g. {a: 1}?
This ensures that we enforce the rules for Oneof Input Objects at execution time.
This ensures the Oneof Objects resolve to an object with exactly one non-null entry.
c13d96a to
165f2ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This enforces the behavior of Oneof Input Object and Oneof Objects during the execution phase of fulfilling a GraphQL request.