Closed kbrandwijk closed 6 years ago
Can you provide links to more resources about @cacheControl
? :)
I have a working example here: https://github.com/kbrandwijk/graphcool-gateway-apollo-engine-demo#caching-example. The reason behind this issue is that adding directives to an existing field in a Gateway is difficult (see: https://github.com/apollographql/graphql-tools/issues/451).
This is not necessarily just about cacheControl, but potentially about any directive not recognized by Graphcool, but useful 'downstream', like the new stream
directive, or any other for that matter.
This may be the wrong place, but has this been addressed? I could really use custom directives defined in my datamodel.graphl
, but Prisma removes them when generating prisma.graphl
. I would like to define custom directives and be able to provide their implementation, and I am also running into the limitations of mergeSchemas
Since this discussion ended ~half a year ago, a lot has changed in the GraphQL ecosystem. You should be able to define directives in your application schema, and also define their logic there.
Feel free to revisit this discussion in a new issue if you feel that this approach could be extended 🙂
@marktani I think it would be very helpful if directives would be 'preserved' across Prisma. When importing Prisma types into your schema, it's still hard to add directives to them.
Yup, let's continue the discussion here: #1228 🙂
What feature are you missing? I am trying to configure caching on my Apollo API Gateway. For this, I need to add
@cacheControl
directives to my Types and fields. When I try to do that, the server doesn't throw any error, but the directives are silently removed. Unfortunately,mergeSchemas
does not allow redefining fields, so it would be helpful if I could add them on the Graphcool side.Also, the top-level queries that are generated are not accessible from the schema. It would be nice to be able to define cacheControl attributes for the generated query fields as well somehow.
Apollo Cache Control is an open standard, that will not only be implemented by Apollo Server, but also Sangria, etc. (according to their docs), so this is not a 'vendor-specific' thing.
How could this feature look like in detail? Tradeoffs?
Then the generated queries would also get that setting:
Depends on: