You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Code generation fails when the graphql schema includes the @authenticated directive.
error: invalid schema: Undefined directive authenticated.
Describe the solution you'd like
Generation works with this directive out of the box, or can be configured in genqlient.yaml.
Describe alternatives you've considered
Currently I remove instances of @authenticated from the schema using sed: sed 's/@authenticated//' schema.graphql > schemaWithoutAuthenticated.graphql
Hmm, I think the server/schema was supposed to provide the directive definition if it refers to the directive. (Spec language is here.) If it doesn't, you could probably just add the definition to your schema:
I'm curious though how you're getting a schema with undefined directives. Reading the docs, maybe this is something where apollo has their own @link spec that defines a different way to define directives? But I think that should only be if you're a subgraph where your client is the federation server. genqlient is a regular client, so it's generally designed to talk to your supergraph schema, which I think should resolve (really, hide) any federation fanciness. It's not necessarily a problem to use it to talk to a subgraph directly, but you'd have to work out how to handle details like this (e.g. patch in the federation definitions).
Or, if you have a concrete suggestion for what we should support (e.g. how to implement support for @link -- it's not even clear to me from reading the spec if there's a way to resolve them to an actual definition without prior knowledge), concrete suggestions are welcome!
Thanks for the feedback! You are right that declaring the directive instead of importing it via @link solved the issue. I was able to compose a supergraph and generate off that 👍
Is your feature request related to a problem? Please describe.
Code generation fails when the graphql schema includes the @authenticated directive.
error:
invalid schema: Undefined directive authenticated.
Describe the solution you'd like
Generation works with this directive out of the box, or can be configured in genqlient.yaml.
Describe alternatives you've considered
Currently I remove instances of @authenticated from the schema using sed:
sed 's/@authenticated//' schema.graphql > schemaWithoutAuthenticated.graphql
Additional context
Doc on authenticated directive from Apollo: https://www.apollographql.com/docs/router/configuration/authorization/#authenticated
The text was updated successfully, but these errors were encountered: