Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gmac/schema-stitching-handbook

Guided examples exploring GraphQL Tools v6+ Schema Stitching
https://github.com/gmac/schema-stitching-handbook

graphql graphql-tools remote-schemas schema-stitching

Last synced: 13 days ago
JSON representation

Guided examples exploring GraphQL Tools v6+ Schema Stitching

Awesome Lists containing this project

README

        

# ![Schema Stitching Handbook](./images/banner-1.jpg)

Guided examples of [GraphQL Stitching](https://the-guild.dev/graphql/stitching/docs) doing useful things. While this book focuses on [GraphQL Tools](https://github.com/ardatan/graphql-tools) (JavaScript) and its specific capabilities, many of these general schema stitching concepts apply to implementations across languages, see similar projects:

- [Bramble](https://github.com/movio/bramble) (Golang)
- [graphql-stitching-ruby](https://github.com/gmac/graphql-stitching-ruby) (Ruby)

## Table of Contents

### Installation

From the root directory, run:

```sh
yarn install
```

### Foundation

- **[Combining local and remote schemas](./combining-local-and-remote-schemas)**

- Adding a locally-executable schema.
- Adding a remote schema, fetched via introspection.
- Adding a remote schema, fetched from a custom SDL service.
- Avoiding schema conflicts using transforms.
- Authorization headers.
- Basic error handling.

- **[Mutations & subscriptions](./mutations-and-subscriptions)**

- Adding a remote mutation service.
- Adding a remote subscription service.
- Adding a subscriber proxy.

- **[Single-record type merging](./type-merging-single-records)**

- Type merging using single-record queries.
- Query/execution batching.

- **[Array-batched type merging](./type-merging-arrays)**

- Type merging using array queries.
- Handling array errors.
- Nullability & error remapping.

- **[Merged types with multiple keys](./type-merging-multiple-keys)**

- Configuring multiple key entry points for a merged type.

- **[Nullable merges](./type-merging-nullables)**

- Selecting nullability for merged fields.
- Returning nullable and not-nullable results.

- **[Custom merge resolvers](./custom-merge-resolvers)**

- Using `valuesFromResults` to normalize resulting query data.
- Adapting type merging to query through namespaced scopes.
- Adapting type merging to query through non-root fields.
- Using `batchDelegateToSchema` and `delegateToSchema`.

- **[Cross-service interfaces](./type-merging-interfaces)**

- Distributing a GraphQL interface across services.

- **[Computed fields](./computed-fields)**

- Configuring computed fields.
- Sending complex inputs to subservices.
- Normalizing subservice deprecations in the gateway.

- **[Stitching directives SDL](./stitching-directives-sdl)**

- `@key` directive for type-level selection sets.
- `@merge` directive for type merging services.
- `@computed` directive for computed fields.
- `@canonical` directive for preferred element definitions.

### Architecture

- **[Hot schema reloading](./hot-schema-reloading)**

- Hot reload of the combined gateway schema (no server restart).
- Polling for remote subschema changes.
- Mutations for adding/removing remote subservices.
- Handling subservice request timeouts.

- **[Versioning schema releases](./versioning-schema-releases)**

- Using GitHub API to manage a simple schema registry.
- Hot reloading from a remote Git registry.
- Running development and production environments.

- **[Continuous Integration (CI) testing](./continuous-integration-testing)**

- Adding test coverage to a stitched schema.
- Mocking subservices as local test fixtures.

- **[Public and private APIs](./public-and-private-apis)**

- Filtering unwanted fields from the final stitched schema.
- Serving public (filtered) and private (unfiltered) API versions.

### Other Integrations

- **[Federation services](./federation-services)**

- Integrating Apollo Federation services into a stitched schema.
- Fetching and parsing Federation SDLs.

- **[Subservice languages](./subservice-languages)**

- **[JavaScript](./subservice-languages/javascript)** schemas created with:

- `graphql-js`
- `nexus`
- `type-graphql`

- **[Ruby](./subservice-languages/ruby)** schemas created with:

- Class-based definitions
- Parsed definitions string

- **[GraphQL Upload](./graphql-upload)**

- Adding GraphQL Upload to the gateway server

### Appendices

- [What is Array Batching?](https://github.com/gmac/schema-stitching-demos/wiki/Batching-Arrays-and-Queries#what-is-array-batching)
- [What is Query Batching?](https://github.com/gmac/schema-stitching-demos/wiki/Batching-Arrays-and-Queries#what-is-query-batching)