You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subscription queries made against a schema that doesn't support subscriptions should result in a GraphQLError #875
Related to #349, if a subscription query is attempted against a schema that doesn't support subscriptions, we raise an AssertException instead of a GraphQLError.
Steps to reproduce
The test below showcases the issue by making a subscription query against a schema that has no root subscription type defined.
def"a subscription query against a schema that doesn't support subscriptions should result in a GraphQL error"() {
given:
GraphQLSchema schema = newSchema().query(
newObject()
.name("Query")
)
.build()
when:
def result =newGraphQL(schema).execute("subscription { doesNotExist }")
then:
result.errors.size() ==1
result.errors[0].class ==MissingRootTypeException
}
will throw
graphql.AssertException: you must provide a graphql type
at graphql.Assert.assertNotNull(Assert.java:12)
at graphql.execution.ExecutionTypeInfo.<init>(ExecutionTypeInfo.java:37)
at graphql.execution.ExecutionTypeInfo.<init>(ExecutionTypeInfo.java:23)
at graphql.execution.ExecutionTypeInfo$Builder.build(ExecutionTypeInfo.java:237)
at graphql.execution.Execution.executeOperation(Execution.java:140)
at graphql.execution.Execution.execute(Execution.java:98)
at graphql.GraphQL.execute(GraphQL.java:546)
at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:488)
at graphql.GraphQL.executeAsync(GraphQL.java:463)
at graphql.GraphQL.execute(GraphQL.java:394)
at graphql.GraphQL.execute(GraphQL.java:265)
at graphql.GraphQLTest.null subscription type should result in a GraphQL error(GraphQLTest.groovy:282)
Expected behavior
A regular GraphQLError should be returned, similar to what is currently being done with mutations.
Activity