GraphQL S2S (Schema-to-Schema) is a transpiler that extends standard GraphQL SDL with type inheritance, generic types, metadata decoration, and query deconstruction/transformation/rebuilding. Version 0.22.0 is the latest stable release. It allows developers to define reusable schema patterns before transpiling to standard GraphQL syntax for graphql-js and Apollo Server. Key differentiators: supports multiple inheritance, generic type parameters (like Paged<T>), schema-level metadata annotations, and programmatic query manipulation. Unlike graphql-modules or type-graphql, graphql-s2s works purely at the SDL string level without requiring class definitions or decorators.
npm install graphql-s2sNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows transpilation of an enriched schema with inheritance to standard GraphQL.
Use destructuring: const { transpileSchema } = require('graphql-s2s').graphqls2s (old) or import { transpileSchema } from 'graphql-s2s' (new).Use named ESM imports or await import('graphql-s2s').Always declare all fields in the child type, even if inherited.
Always use Paged<Question> not just Paged.
Manually deduplicate or use interface merging patterns.
Use import { transpileSchema } from 'graphql-s2s' (ESM) or const { transpileSchema } = require('graphql-s2s').graphqls2s only for versions <0.16.0; for >=0.16.0 use const { graphqls2s } = require('graphql-s2s'); const { transpileSchema } = graphqls2s.Run 'npm install graphql-s2s' and ensure node_modules contains it.
Instantiate the generic: type Paged<T> { data: [T] } then type Query { items: Paged<Item> }.Use require('graphql-s2s').graphqls2s.transpileSchema(...) or import the named export.