Closed
Description
GraphQL (https://spec.graphql.org/October2021/#sec-Schema) allows for the Query and Mutation elements to be renamed as in
schema {
query: MyQuery
mutation: MyMutation
}
type MyQuery {
hello: String!
}
type MyMutation {
saveGreeting(greeting: String!): String!
}
With a controller
@Controller
public class HelloController {
private String greeting = "Hello";
@QueryMapping
public String hello() {
return greeting;
}
@MutationMapping
public String saveGreeting(@Argument String greeting) {
this.greeting = greeting;
}
}
When sending a request, neither method is invoked and the framework silently returns null - with an error of some form
{
"errors": [
{
"message": "The field at path '/hello' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'String' within parent type 'MyQuery'",
"path": [
"hello"
],
"extensions": {
"classification": "NullValueInNonNullableField"
}
}
],
"data": null
}
I also tried changing my annotations @QueryMapping("MyQuery.hello") but that doesn't work either.
Does the framework only support Query and Mutation for the names? That makes it difficult to bring in 3rd party schemas