-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously gateways could express their executor in two ways: as the executor method (required to exist!) and as part of the return value from load (which was ignored!). Now we just return it from load, and allow it to be null. This supports a mocking use case. Fixes #5518. It lets you do something like: import { addMocksToSchema } from '@graphql-tools/mock'; const realGateway = new ApolloGateway(); const gateway: GatewayInterface = { async load(options) { const { schema } = await realGateway.load(options); return { schema: addMocksToSchema({ schema }), executor: null, }; } stop() { return realGateway.stop(); } onSchemaLoadOrUpdate(callback) { return realGateway.onSchemaLoadOrUpdate(callback); } }; const server = new ApolloServer({ gateway }); to define a server that follows a managed federation graph but executes queries using mocking.
- Loading branch information
Showing
5 changed files
with
22 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters