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
This will validate @oneOf variable values when the variables are coerced #3580
base: master
Are you sure you want to change the base?
Conversation
…ced - fixed tests
static Object externalValueToInternalValueImpl( | ||
String variableName, |
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.
needed to add a variable name for error message reasons
when: | ||
def resolvedValues = ValuesResolver.coerceVariableValues(schema, [variableDefinition], RawVariables.of([variable: [a: 'x']]), graphQLContext, locale) | ||
then: | ||
resolvedValues.get('variable') == [a: 'x'] |
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.
one is ok - or the other is ok but not both
@@ -169,14 +169,14 @@ class GraphQLInputObjectTypeTest extends Specification { | |||
er = graphQL.execute(ei) | |||
then: | |||
!er.errors.isEmpty() | |||
er.errors[0].message == "Exception while fetching data (/f) : Exactly one key must be specified for OneOf type 'OneOf'." | |||
er.errors[0].message == "Exactly one key must be specified for OneOf type 'OneOf'." |
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.
now caught earlier during variable value coercion
This will call the oneOf validation during the coercion of the variables during execution.
This MAY make the later validation during argument retrieval slightly redundant however there are other paths that can enter this value code so I have left it in place
This PR plus #3577 will mean variables and literals are covered