-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@cacheControl
support tests, fixes...
#351
base: main
Are you sure you want to change the base?
Conversation
🚀 Snapshot Release (
|
Package | Version | Info |
---|---|---|
@graphql-tools/federation |
3.0.4-alpha-a700ce8ccd87f79236970cc1b9eb9826c65ccccd |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/fusion-runtime |
0.10.23-alpha-a700ce8ccd87f79236970cc1b9eb9826c65ccccd |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/gateway |
1.7.2-alpha-a700ce8ccd87f79236970cc1b9eb9826c65ccccd |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-opentelemetry |
1.3.30-alpha-a700ce8ccd87f79236970cc1b9eb9826c65ccccd |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-prometheus |
1.3.18-alpha-a700ce8ccd87f79236970cc1b9eb9826c65ccccd |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/gateway-runtime |
1.4.2-alpha-a700ce8ccd87f79236970cc1b9eb9826c65ccccd |
npm ↗︎ unpkg ↗︎ |
🚀 Snapshot Release (Bun Docker Image)The latest changes of this PR are available as image on GitHub Container Registry (based on the declared
|
🚀 Snapshot Release (Node Docker Image)The latest changes of this PR are available as image on GitHub Container Registry (based on the declared
|
When somebody runs |
You know extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.1"
import: ["@composeDirective"]
)
@link(url: "https://the-guild.dev/mesh/v1.0", import: ["@cacheControl"])
@composeDirective(name: "@cacheControl") If they use mesh-compose, it respects Is that what you asked or did I misunderstand it fully 😅 ? |
Yeah, that's what I asked about. We need to make sure it's well documented |
de9c33d
to
a700ce8
Compare
@ardatan can you add documentation of this as part of this PR? |
also, how does Apollo's gateways handle this? |
If I don't miss anything ( @kamilkisiela can correct me if I'm wrong ) , it respects cache-control headers as our http cache plugin does since |
I wanted to make everything clear first with this PR before starting a documentation PR on console repository. |
@ardatan I would like to review the docs and this together, as it will help me understand everything before I review about Apollo, can you create an example and test how it actually behaves? |
The "shortest" time from This is how it works in Apollo Server - gateway. |
Apollo Router caches only the entity calls (to my knowledge) and it respects |
Today if you
@cacheControl
directive in your subgraphs with Apollo Server, it sends cache control headers. And this is supported by http cache plugin. You don't need@composeDirective
etc.If you use those directives without ApolloServer, you can give the control to the gateway using Response Caching plugin but in order to have those directives in your gateway, you have to add the directive using
@composeDirective
so the supergraph can have it and response caching plugin can pick it up and use it.This PR fixes the following issue when the directive definitions got lost while handling the supergraph using
@graphql-tools/federation
.It also adds tests for both the cases mentioned above.
Needs to be documented on the website!!!
See the conversation below with @kamilkisiela to make sure to get what is documented!
After merging this PR, we need to update the docs with the two cases. And we need to mention http caching plugin can be used with the subgraph services returning cache control headers on its own and no
@composeDirective
.If the subgraph is expected to control gateway's caching, response caching should be added and
@composeDirective
should be added for@cacheControl
;