Apollo Link for executing GraphQL operations against a local schema, useful for server-side rendering and mocking. Current stable version is 1.2.5. This package allows you to bypass network calls by using a provided GraphQL schema directly, often within a Node.js server for SSR or with mock data. It is part of the Apollo Link ecosystem and integrates with Apollo Client. The schema link uses the graphql execution layer (via graphql-js). Key differentiators: enables SSR without network overhead, and supports mocking via graphql-tools. However, it is recommended to use apollo-link-state for client-side state management as graphql-js is heavy for clients. Release cadence is low; no recent updates. Note: peer dependency on graphql versions 0.11-15.
npm install apollo-link-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a SchemaLink with a local executable schema and using it with Apollo Client for server-side rendering.
Use @apollo/client `Reactive Variables` or `apollo-link-state` for client-side state.
Use apollo-link-state or local resolvers in Apollo Client 3+ for client-only operations.
If using graphql 16, consider upgrading to Apollo Client 3 or using a different link.
Define context and rootValue types explicitly; use `context: (operation) => ({...})` for dynamic context.Replace `graphql-tools` with `@graphql-tools/schema` for makeExecutableSchema.
Ensure schema is executable via makeExecutableSchema or a schema object with resolvers.
Run `npm dedupe` or use `resolutions` in package.json to pin a single graphql version.
Downgrade graphql to version 0.15 or earlier, or upgrade to Apollo Client 3 which supports graphql 15+.
Pass a schema object: `new SchemaLink({ schema })` where schema is an executable GraphQLSchema.Use `makeExecutableSchema({ typeDefs, resolvers })` to create an executable schema first.