menu

Apollo

A community of developers, designers and others who love Apollo and GraphQL. 🚀

Channels
# All channels
view-forward
# General
view-forward
# Apollo Angular
view-forward
# Announcements
view-forward
# Apollo Android
view-forward
# Apollo Client
view-forward
# Apollo iOS
view-forward
# Apollo Link
view-forward
# Apollo Link Rest
view-forward
# Local State
view-forward
# Apollo Studio
view-forward
# Apollo Server
view-forward
# Apollo Tooling
view-forward
# Contributing
view-forward
# Docs
view-forward
# Events
view-forward
# GraphQL Tools
view-forward
# Jobs
view-forward
# Random
view-forward
# React Apollo
view-forward
# Showcase
view-forward
# Subscriptions
view-forward
# Testing
view-forward
# Vue Apollo
view-forward
Team

Mocking at Apollo Gateway level?

January 23, 2020 at 8:02am

Mocking at Apollo Gateway level?

January 23, 2020 at 8:02am
Hey Apollo team! We would be curious to hear if mocking at the Apollo Gateway level is part of the roadmap of the Apollo Federation?
We run a Gateway with two federated services, which gives us great flexibility because we can start one service in dev mode while starting the other in mock mode.
Though we have cases where frontend engineers don't need to start any services in dev mode, they just need mock mode for all federated services. As a way to improve the developer experience, we thought it would be neat to allow us to start the Apollo Gateway in mock mode, without the need to start the federated services.
We are trying to think about how minimal can be the setup for the engineering teams:
  • frontend engineers would only need to run the Gateway in Mock mode
  • backend engineer working on federated service 1 would only need to run Gateway in mock mode + Federated service 1 in dev mode using a DB. All other federated services would be mocked by default.
Curious to hear any thoughts and ideas!
Warmly, -Phil

February 10, 2020 at 7:43am
Hello, I've built a simple library that does a little bit of what you are asking here: https://github.com/TheBrainFamily/federation-testing-tool it's mainly used for testing but I believe it could be used as a base for your usecase. Especially for the second case (working with one federated service) You'd probably want to setupSchema and setupMocks as done here: https://github.com/TheBrainFamily/federation-testing-tool/blob/master/index.js#L232-L235 but then instead of executing a graphql query you'd want to create a server with that prepared and partially mocked schema
Take a look and tell me if it makes sense, I'd be happy to help, as I might need this soon anyway, and having two heads on this problem would definitely be beneficial :)
As for having frontend engineers using the gateway in mock mode - I believe all you need is a generated schema and then you can easily run the client in a mocked state
  • reply
  • like