When I changed to variable execution, it threw an error:
query($first: Int!){
getTest(first: $first){
id
name
}
}
The error:
"errors": [
{
"message": "couldn't convert argument first to string because provided value is not a scalar, can't convert it to string"
}
]
The above is the result of my test in altair client.
If I change the type of first to first: String, the above error will no longer appear, but it does not meet my expectations. first should be of type int.
My confusion was about the type of variables. Just now I noticed that I confused DQL Vars with Value Vars. My reference above is about Value Vars, not DQL.
So, @asuka, sorry for my mistake. DQL Vars and Value Vars are totally different things. Not sure why this parsing error happens. As INT is supported by DQL Vars.
It is a bug with respect to variable handling in GraphQL. Numbers from variables are parsed as json.Number and not int or float scalar types. There is a missing case for json.Number during the conversion to DQL variables.
Will have a PR for it soon.
@MichelDiz meant that ! won’t have any effect in DQL. It is a feature only in GraphQL.
So, in the above line, it will make the first argument as NON_NULL. But, you don’t need to apply it inside DQL as you have done it in the next line after the above line:
So, to clarify your question, with GraphQL you can distinguish between required and optional but DQL has no such concept. So, just having the following query will make it a required argument: