-
Notifications
You must be signed in to change notification settings - Fork 10
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-5238bf46e2d893b9b97302c79cb8688eb181f55c |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/fusion-runtime |
0.10.23-alpha-5238bf46e2d893b9b97302c79cb8688eb181f55c |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/gateway |
1.7.2-alpha-5238bf46e2d893b9b97302c79cb8688eb181f55c |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-opentelemetry |
1.3.30-alpha-5238bf46e2d893b9b97302c79cb8688eb181f55c |
npm ↗︎ unpkg ↗︎ |
@graphql-mesh/plugin-prometheus |
1.3.18-alpha-5238bf46e2d893b9b97302c79cb8688eb181f55c |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/gateway-runtime |
1.4.2-alpha-5238bf46e2d893b9b97302c79cb8688eb181f55c |
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 |
07c113d
to
c9ddd1e
Compare
'@graphql-tools/federation': patch | ||
--- | ||
|
||
Keep the custom directives(using @composeDirective) from the supergraph, in the unified schema served by the gateway should keep it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to link here to some issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a feedback on Slack from one of our users.
c9ddd1e
to
bc83ab0
Compare
@Urigo There is no special configuraiton needed for Apollo Gateway/Router in this case but there are two options in Hive Gateway as documented here; |
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
;