Describe the bug
Previously, you could make a query like so:
const String getUsers = """
{
users {
id
name
}
}
"""
however, now the query keyword is required, even if no variables are being passed.
const String getUsers = """
query getUsers {
users {
id
name
}
}
"""
To Reproduce
Steps to reproduce the behavior:
queryExpected behavior
query should not be required.
+1. Query builder should support default behavior of no query keyword.
Moreover, request would fail by unknown operation if the query keyword is now followed by a name.
For example this query should work but not:
query {
items {
id
name
}
}
It has to be:
query GetItemsByOrder {
items {
id
name
}
}
When we use query or mutation without Operation name it will add operation name like
_operationName ??= 'UNNAMED/' + document.hashCode.toString();
And my backend hasura graphql server gives error invalid operation
It's not in just query when I run mutation from bloc (not using mutation widget) throws this error.
@Kyle-Mendes How is this a valid query?
const String getUsers = """
users {
id
name
}
"""
Even if the query keyword is omitted shouldn't there always be wrapping brackets like so:
const String getUsers = """
{
users {
id
name
}
}
"""
@HofmannZ Oops! I accidentally typed it out wrong :) Good catch!
(fixed in the issue body)
yeah this looks like a regression - probably need to decouple operationName from the operation identification functionality I added the default for.
I've been a bit busy, but I should be able to get to this later this week
@micimize any progress?
@endigo I haven't had time to work on it - I would update here proactively if I had
closed by #276
:tada: This issue has been resolved in version 1.0.1-beta.8 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 1.0.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Most helpful comment
+1. Query builder should support default behavior of no
querykeyword.Moreover, request would fail by unknown operation if the
querykeyword is now followed by a name.For example this query should work but not:
It has to be: