I'am trying to use the graphQL federation v2 (supergraph) with NestJS in a code first approach. My problem is that I need to use some specific directives such as @inaccessible, @shareable or @provides, but those directives are not defined in the @nestjs/graphql module.
How can use these specific directives in a code first approach with NestJS ?
Taking a quick look in the source code of @nestjs/graphql there's however some reference to those directives here : https://github.com/nestjs/graphql/blob/6864eb257f949652f7b1a57067c0d9f0a695c03e/packages/graphql/lib/federation/type-defs-federation2.decorator.ts#L8-L17
But when I use the following code :
@Field(type => Profile)
@Directive('@inaccessible')
profile: Profile
I have this error :
GraphQLError: The schema is not a valid GraphQL schema.. Caused by:
Unknown directive "@inaccessible". If you meant the "@inaccessible" federation directive, you should use fully-qualified name "@federation__inaccessible" or add "@inaccessible" to the `import` argument of the @link to the federation specification.
Edit
Following what it is said in the error message, I succeeded in using the @inaccessible directive like this :
@Field(type => Profile)
@Directive('@federation__inaccessible')
profile: Profile
By using the fully-qualified name it worked, but I find this rather inelegant ... So if you have a way to fix this.
Thank you for your help