We’re overhauling Dgraph’s docs to make them clearer and more approachable. If
you notice any issues during this transition or have suggestions, please
let us know.
@generate directive is used to specify which GraphQL APIs are generated
for a given type.
Here’s the GraphQL definition of the directive
Boolean variables inside
the @generate directive to true. Passing false forbids the generation of
the corresponding APIs.
The default value of the subscription variable is false while the default
value of all other variables is true. Therefore, if no @generate directive
is specified for a type, all queries and mutations except subscription are
generated.
Example of @generate directive
queryPerson query and addPerson,
updatePerson mutations. It won’t generate getPerson, aggregatePerson
queries nor a deletePerson mutation as these have been marked as false using
the @generate directive. Note that the updatePerson mutation is generated
because the default value of the update variable is true.