Invalid query generated for object as GraphQL function parameter
See original GitHub issueDescription
I am using Hasura and am trying to run the following query:
query {
test_table(where: { id: { _eq: 1 } }) {
id
some_name
}
}
According to Hasura logs, the actual query that is sent to the server has id
and _eq
wrapped in escaped quotes, which fails validation:
query {
test_table(where: { \"id\": { \"_eq\": 1 } }) {
id
some_name
__typename
}
__typename
}
NOTE: The query works perfectly without parameters, or if sending a multiple “simple” parameters (rather than a nested object), such as: test_table(limit: 1, offset: 1)
Repro steps
Following the readme, I create the provider, operation and run try to run the query:
type MyProvider = GraphQLProvider<"http://localhost:8080/v1/graphql">
let operation =
MyProvider.Operation<"""query q {
test_table(where: { id: { _eq: 1 } }) {
id
some_name
}
}""">()
let runtimeContext =
{ ServerUrl = "http://localhost:8080/v1/graphql"
HttpHeaders = [] }
let result = Commands.operation.Run(runtimeContext)
Expected behavior
The query sent to the server should not contain \"
wrapped around id
and eq
.
Actual behavior
The query sent to the server has \"
wrapped around id
and eq
, which results in an invalid query and an error.
Known workarounds
I was searching for workarounds and found this page in the docs that has an example using GraphQL query DSL, but it seems that .Queries
does not exist on GraphQLProvider
. Has this been deprecated? Are the docs outdated?
Related information
Mac OS X v1.0.2 Both in a .NET Core 3.1 console app, as well as Xamarin with Fabulous
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@Yakimych Sorry for the delay. Can you open another issue with some additional information.
Thanks
@Yakimych This should be fixed with the latest release. Please let me know if you have any issues.
Thanks