I think it is quite common to have to patch the schema generated by GraphQL with some dgraph internal directives.
The most simple case is adding the reverse directive to an edge.
Right now I think the only way is to have a separate file with all the patches and apply it after the push of the GraphQL Schema.
Although it’s not much effort I was wondering if you have already thought to a possible built-in solution.
Example:
type Person {
name: Text!
}
type Text {
string: String!
}
schema patch to traverse the graph from Text to Person:
<Person .name>: uid @reverse .
Possible clean solution
type Person {
name: Text! @dgraphDirective([reverse])
}
type Text {
string: String!
}
I was trying to find a work around to get counts. Now that we have the GraphQL count aggregate queries and fields, that work around is no longer needed. I never spent too much time on it, this was before users could modify the Slash Dgraph schema which is allowed now depending on Slash mode.