Skip to content
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

[Federation] Pass existing GraphQLSchema to buildFederatedSchema. #358

Open
j opened this issue Jul 9, 2019 · 3 comments
Open

[Federation] Pass existing GraphQLSchema to buildFederatedSchema. #358

j opened this issue Jul 9, 2019 · 3 comments

Comments

@j
Copy link

j commented Jul 9, 2019

Just bringing it to the issues area to give it a few eye-balls, feel free to close if it's not wanted or correct.

apollographql/apollo-server#3013

This PR adds support to decorate existing schemas with federation add-ons. While working on the implementation of federation in type-graphql (MichalLytek/type-graphql#369), I realized that it's sort of a pain and pointless to convert from GraphQLSchema to SDL and back and to SDL again as well as pluck out the GraphQL*Type resolvers when buildFederatedSchema should just be able to take in an already constructed schema and modify it.

@j
Copy link
Author

j commented Jul 18, 2019

@jbaxleyiii mind giving apollographql/apollo-server#3013 a review?

@abernix abernix transferred this issue from apollographql/apollo-server Jan 15, 2021
@mgm87
Copy link

mgm87 commented Jul 12, 2021

Is this going to go anywhere? It is a feature I would really like to see!

@smyrick
Copy link
Member

smyrick commented Nov 30, 2022

I will add that modifying an existing schema would really only be able to add the Federation type definitions. The Apollo function buildSubgraphSchema wouldn't have enough context to know what other resolvers you might want to add like __resolveReference. So really what you need to do is just add some directives to an existing schema. That can be done today with tools like graphql-tools merge.

I have a working example of how to do exactly that here: https://github.com/apollosolutions/add-federated-types

This takes some existing SDL and adds merges it with the Federation spec. It will not be able to add resolvers for you but it is a way to "automatically" include the @link directives if you want or add @key to certain types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants