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
Running a mutation query against a schema without defined mutations throws NullPointerException. #345
java.lang.NullPointerException
at graphql.execution.ExecutionStrategy.getFieldDef(ExecutionStrategy.java:150)
at graphql.execution.ExecutionStrategy.resolveField(ExecutionStrategy.java:25)
at graphql.execution.SimpleExecutionStrategy.execute(SimpleExecutionStrategy.java:18)
at graphql.execution.Execution.executeOperation(Execution.java:56)
at graphql.execution.Execution.execute(Execution.java:31)
at graphql.GraphQL.execute(GraphQL.java:84)
It looks like parentType passed to the execution context is null, causing the error. I'm not quite sure what should be returned, but some GraphQL error should be returned instead (field missing?).
Note that this is only when using the 1-arg constructor for GraphQLSchema or passing null as the mutation type in the 3-arg constructor. If you pass an "empty" mutation object type, the exception goes away and a GraphQL error is returned to the caller:
{"errors":[{"validationErrorType":"FieldUndefined","message":"Validation error of type FieldUndefined: Field echo is undefined","errorType":"ValidationError","locations":[{"line":1,"column":12}]}]}
Activity
apottere commentedon Mar 20, 2017
Note that this is only when using the 1-arg constructor for
GraphQLSchemaor passingnullas the mutation type in the 3-arg constructor. If you pass an "empty" mutation object type, the exception goes away and a GraphQL error is returned to the caller:bbakerman commentedon Mar 21, 2017
Can you give a code example to help with reproduction.
apottere commentedon Mar 21, 2017
This throws a
NullPointerException:As does this:
This does not:
graphql-java#345 - mutations are optional and errors should come back…
graphql-java#345 - spillin misteak
graphql-java#345 - moor spillin misteaks
Merge pull request #349 from bbakerman/345-npe-on-missing-mutation