-
-
Notifications
You must be signed in to change notification settings - Fork 437
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
Apollo federation v2 #2460
Apollo federation v2 #2460
Conversation
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.
Nicely done, happy to include this.
Do the docs need additional updates? Any gotchas regarding how Lighthouse implements the spec? |
I've update the docs with some info of how to enabled v2 support and the unsupported features regarding directive imports |
Thank you very much! |
Wow, massive effort, thanks for making the PR @cappuc 💪 |
I opened the PR to update the apollo compatibility |
@cappuc I'm playing around with this trying to combine multiple Lighthouse servers into a supergraph and running into that the built-in types are colliding, like the Did you encounter that too or are you not using this with multiple Lighthouse servers yet? |
I don't use built-in pagination so I didn't notice this issue. |
I'm wondering if it makes sense to just register the Just my 2-cents, love the work you've been doing on the Federation support 💪 |
I think that always adding the |
Ah yes. That makes sense, could also be a configuration setting to make it easier. But forgot that it's backwards compatible of course. |
@stayallive I've opened a PR #2485 to mark pagination types as |
Not yet, but very nice, I don't have a complicated graph but pagination is something I use heavily so maybe there is more, I'm sure someone will open an issue if needed 💪 |
This PR adds support for Apollo Federation v2 (except for federated tracing).
I've tested this changes with the apollo compatibility test suite and I will make a PR with the required changes to the test app (here you can see the changes for the compatibility test).
Resolves #2160
Changes
In order to support Federation v2 the subgraph needs to extend the
schema
with the link to the spec version and import the used directives:With this implementation the schema extension must be manually added by the user to the graphql schema.
I've added the new directives of v2 but right now there is no check on usage of this new directives without the schema extension.
The other required changes are on the
FederationPrinter
because we need to print in the service sdl the schema extension and the definition of directives passed to@composeDirective
.Possible improvements
The apollo spec allow to use federation directives without the import, adding the spec prefix:
or with alias:
and also renaming imported directives:
This options are not supported right now.
Breaking changes
It should be backward compatible with v1 because the schema extension required for v2 must be manually added by the user.