router
router copied to clipboard
Support mock mode for the Router
Is your feature request related to a problem? Please describe. I have a supergraph that may or may not have a deployed subgraph url or environment or I am just doing schema design locally
Describe the solution you'd like I want to be able to write some graphql schemas and even though I do not have a running subgraph powering that schema I want to be able to query my pretend composed schema and integrate client code.
The data returned could just be hard coded, I don't need to provide mocked responses. I just want every String in the schema to return some string data
Ideally this would be just a YAML config
supergraph:
mock: true
It might also be nice to do this on a per subgraph level
override_subgraph:
products:
url: "http://localhost:3000"
mock: true
Describe alternatives you've considered I could write a coprocessor to interject every subgraph request to do this
Additional context Apollo Server used to, and still does through external tools, have the ability to turn on mock mode: https://www.apollographql.com/docs/apollo-server/testing/mocking/
This means that can also be used for a Gateway and so those on Gateway migrating to Router will loose the ability to mock their supergraph
As a work around today you can use a coprocessor on a RouterRequest and return mock data for the given supergraph sdl and operation, but a built-in feature of Router would be preferred