Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package graphql.analysis

import graphql.ExecutionInput
import graphql.ExecutionResult
import graphql.GraphQL
import graphql.TestUtil
import graphql.execution.AbortExecutionException
import graphql.execution.instrumentation.InstrumentationContext
Expand Down Expand Up @@ -161,4 +163,30 @@ class MaxQueryDepthInstrumentationTest extends Specification {
test == true
notThrown(Exception)
}

def "coercing null variables that are marked as non nullable"() {

given:
def schema = TestUtil.schema("""
type Query {
field(arg : String!) : String
}
""")

MaxQueryDepthInstrumentation maximumQueryDepthInstrumentation = new MaxQueryDepthInstrumentation(6)
def graphQL = GraphQL.newGraphQL(schema).instrumentation(maximumQueryDepthInstrumentation).build()

when:
def query = '''
query x($var : String!) {
field(arg : $var)
}
'''
def executionInput = ExecutionInput.newExecutionInput(query).variables(["var": null]).build()
def er = graphQL.execute(executionInput)

then:
! er.errors.isEmpty()

}
}