Hey team, we have a couple of graphQL developed with yoga, I wonder if you can help guide us on how we can convert those graphQL endpoints as a subgraph and configured to Apollo Federation. I did not find explicit document on this but it seems that we need to configure with Envelop and then use the Apollo plugin to configure with federation?
Hello graphql-yoga is fully compatible with Apollo Federation. You just need to add the dependency on @apollo/subgraph and then follow the steps defined in the docs (basically add the __resolveReference methods to the entities).
We are working on making it simpler but currently in order to expose your REST APIs as a subgraph, you would need to expose it as a fully fledged GraphQL subgraph (and your resolvers would make downstream calls to your REST API).
Thank you so much! Do you mean that I need to create a schema that maps to the rest API and use datasources package to convert the REST API into subgraph?
Also one last question, we also have a few gRPC APIs but I did not find explicit document about how to convert gRPC API into subgraphs. I am assuming the process would be similar to REST API.
Yes you would need to create a schema and within your resolvers you can call whatever APIs to ger your data (REST, gRPC, databases or whatever).
Note that while it might be useful to expose this downstream data directly in a GraphQL schema (i.e. provide 1:1 mapping), in many cases it might be beneficial to actually abstract away those sources of data and provide something that is more usable to the clients. TLDR is → I’d recommend to always design your schema with your clients needs.