With the following schema query definition
final GraphQLObjectType queryType = newObject()
.name("QueryType")
.field(newFieldDefinition()
.name("foo")
.type(Foo)
.argument(newArgument()
.name("id")
.description("The id of the foo")
.type(new GraphQLNonNull(GraphQLID)))
.dataFetcher(getFetcherForResource("foo")))
.build();
The query
{ foo(id:"1") { id bar } }
works ok, but the query
fails with
{"errors":[{"validationErrorType":"WrongType","message":"Validation error of type WrongType: argument value IntValue{value=1} has wrong type","locations":[{"line":1,"column":10}],"errorType":"ValidationError"}],"data":null}
According to the
GraphQL spec:
When expected as an input type, any string (such as "4") or integer (such as 4) input value should be coerced to ID as appropriate for the ID formats a given GraphQL server expects. Any other input value, including float input values (such as 4.0), must raise a query error indicating an incorrect type.
Also, if attempt to populate my response object to this query with a numeric value, it appears in the JSON result as null rather than a stringified form of that value. Again I believe the GraphQL spec states that servers should coerce results as appropriate before serializing ID values to JSON strings.
Is there some way to configure the graphql server to accept numeric-format ID values?
Thanks
Alan