Closed bjonica closed 7 years ago
world
is a TextInput
in your example, not a String, so the correct query should be (but I haven't run it):
{
hello(world: {text: {value: "World"}})
}
So, the query is indeed invalid but the error message is a bit misleading. (Or the schema/query you supplied is not the one that produced the error?)
My mistake. Corrected the query to yours, but same problem.
{
"errors": [
{
"error": "Argument 'world' of type 'WorldInput' has invalid value: {text: [:object-value {:value World}]}. Reason: Expected 'WorldInput', found not an object.",
"loc": {
"line": 2,
"column": 16
}
}
]
}
I am not sure whether nested input type are supposed to work or not.
Input Type is defined in GraphQL Spec:
GraphQL describes the types of data expected by query variables. Input types may be lists of another input type, or a non‐null variant of any other input type.
Variables can only be scalars, enums, input objects, or lists and non‐null variants of those types. These are known as input types. Objects, unions, and interfaces cannot be used as inputs.
Just found this from type system definition:
An Input Object defines a set of input fields; the input fields are either scalars, enums, or other input objects. This allows arguments to accept arbitrarily complex structs.
Nested input type should be supported.
Currently parser treats input values as object values which is incorrect.
We need enhance the parser and validator to support this case.
This issue is fixed in latest version.
Whenever a schema has an input object within another input object, I get a "Expected 'SomeType', found not an object." error. Not sure what's going on.
Given schema:
and query:
The response from the server is