I’m trying to write a DQL query I like to use in a custom query in GraphQL based on the @groupby aggregator. I’m grouping a type on one of it’s field and the result is:
@rajas I think he is saying that he is not able to do use @ in naming groupby field inside the GrpahQL schema like this:
type GroupedPropertyMapQ @remote {
@groupby: [PropertyMap]
}
That is not possible because the GraphQL spec limits the character set of names in the schema to this: /[_A-Za-z][_0-9A-Za-z]*/
I believe we will need to figure out a way to support this use case with @groupby. Dgraph response will be returning @groupby, so we need a way to convey to the GraphQL layer to parse it using @groupby and not just groupby. Maybe we can enhance @dgraph directive to support this use-case.
Thanks @doude for bringing this to our notice, we will try to find out a way about how to achieve this and will keep you updated on the same.
Hey @doude, this issue has been fixed in the master. Please see this PR for more details. We have introduced one new directive named as @remoteResponse. Using this directive you can modify your schema a little bit and can get the desired result. Just change this type:-
type GroupedPropertyMapQ @remote {
groupby: [PropertyMap] @remoteResponse(name: "@groupby")
}