Company
Date Published
Author
Patrick Arminio
Word count
1169
Language
English
Hacker News points
None

Summary

The author of the blog post needed to add a third-party API to their Apollo Federation Gateway schema without creating a new service. They used local schemas inside the Apollo Gateway, which requires specifying a list of GraphQL services as objects with a name and a URL. However, they encountered issues using Prismic's GraphQL API directly due to its GET requests instead of POST requests and lack of necessary fields for federation. To overcome this, they created a custom DataSource that proxies the requests to Prismic by building a local schema using `buildService` and providing a function called `getCountriesSchema`. This function uses utilities from `graphql-tools` and `graphql-transform-federation` to create a proxy schema with support for Federation. The author concludes that while it requires some code, this approach simplifies how clients fetch data and enables the use of Apollo Federation features with non-federated services.