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
Currently we retrieve directives by calling .directives on the AST node, but this limits users with a code-first approach since in order for users to specify inheritMaxAgeit has to be statically defined
We currently already use parts of @graphql-tools/*. We can use @graphql-tools/utilsgetDirectives so that users with a code-first approach are able to specify directives via extensions.directives.
So something like:
cacheAnnotationFromDirectives([// read directives from schema
...t.astNode.directives,// read directives specified under `extensions`
...getDirectives(schema,t.astNode)])
It's an interesting point. I do know that some movement has happened lately in the GraphQL world as far as potentially providing a more standard way of exposing directives (eg graphql/graphql-spec#300) and it might be a bit of a shame to adopt the non-standard extensions.directives from graphql-tools if a more standard way is coming soon. I'm not sure why it's impossible for TypeGraphQL to just create AST nodes directly...
Issue
Currently we retrieve directives by calling
.directives
on the AST node, but this limits users with a code-first approach since in order for users to specifyinheritMaxAge
it has to be statically definedContext
apollo-server/packages/apollo-server-core/src/plugin/cacheControl/index.ts
Lines 305 to 321 in f6c5c9f
apollo-server/packages/apollo-server-core/src/plugin/cacheControl/index.ts
Lines 305 to 321 in f6c5c9f
apollo-server/packages/apollo-server-core/src/plugin/cacheControl/index.ts
Lines 323 to 333 in f6c5c9f
graphql/graphql-js#3213 (comment)
graphql/graphql-js#1343
Proposal
We currently already use parts of
@graphql-tools/*
. We can use@graphql-tools/utils
getDirectives
so that users with a code-first approach are able to specify directives viaextensions.directives
.So something like:
and then users could do:
The text was updated successfully, but these errors were encountered: