-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
When the type of an argument is a list of @oneOf input objects, those values are not validated.
Test for src/test/groovy/graphql/execution/ValuesResolverTest.groovy
def "getArgumentValues: invalid oneOf input validation applied with list of input type"() {
given: "schema defining input object"
def inputObjectType = newInputObject()
.name("oneOfInputObject")
.withAppliedDirective(Directives.OneOfDirective.toAppliedDirective())
.field(newInputObjectField()
.name("a")
.type(GraphQLString)
.build())
.field(newInputObjectField()
.name("b")
.type(GraphQLInt)
.build())
.build()
def inputValue = buildObjectLiteral([
oneOfField: [
a: StringValue.of("abc"),
b: IntValue.of(123)
]
])
def inputArray = ArrayValue.newArrayValue().value(inputValue).build()
def argument = new Argument("arg", inputArray)
when:
def fieldArgumentList = newArgument().name("arg").type(list(inputObjectType)).build()
ValuesResolver.getArgumentValues([fieldArgumentList], [argument], CoercedVariables.emptyVariables(), graphQLContext, locale)
then:
def e = thrown(OneOfTooManyKeysException)
e.message == "Exactly one key must be specified for OneOf type 'oneOfInputObject'."
}Metadata
Metadata
Assignees
Labels
No labels