hasura / go-graphql-client

Package graphql provides a GraphQL client implementation.
MIT License
395 stars 91 forks source link

Better support for directives #148

Open NPellet opened 1 month ago

NPellet commented 1 month ago

In the current situation, directives can only be passed at the top-level query. However in practice, https://graphql.org/learn/queries/#directives shows clearly that directives can be used for any field of the gql query.

I would propose, during serialisation of the gql query, to check for

type Directive interface {
  Directive() string
}

for every type, and, if the interface is fulfilled, add the directive to the query.