{"id":25654,"library":"graphql-s2s","title":"graphql-s2s","description":"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.","status":"active","version":"0.22.0","language":"javascript","source_language":"en","source_url":"https://github.com/nicolasdao/graphql-s2s","tags":["javascript","graphql","schema","transpiler","metadata","inheritance","generic","types","neap"],"install":[{"cmd":"npm install graphql-s2s","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-s2s","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-s2s","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for typeDefs and schema construction","package":"graphql","optional":false}],"imports":[{"note":"ESM named export since v0.18.0; CommonJS users need to destructure from .graphqls2s.","wrong":"const transpileSchema = require('graphql-s2s').graphqls2s.transpileSchema","symbol":"transpileSchema","correct":"import { transpileSchema } from 'graphql-s2s'"},{"note":"Default export is the graphqls2s object (CommonJS compatibility); ESM prefers named exports.","wrong":"const graphqls2s = require('graphql-s2s')","symbol":"graphqls2s","correct":"import { graphqls2s } from 'graphql-s2s'"},{"note":"For query AST manipulation; available since v0.12.0.","symbol":"deconstructQuery","correct":"import { deconstructQuery } from 'graphql-s2s'"}],"quickstart":{"code":"import { transpileSchema } from 'graphql-s2s';\nimport { makeExecutableSchema } from '@graphql-tools/schema';\n\nconst enrichedSchema = `\ntype Node {\n  id: ID!\n}\ntype Person inherits Node {\n  firstname: String\n  lastname: String\n}\ntype Query {\n  people: [Person]\n}\n`;\n\nconst schema = makeExecutableSchema({\n  typeDefs: [transpileSchema(enrichedSchema)],\n  resolvers: {\n    Query: {\n      people: () => [{ id: '1', firstname: 'John', lastname: 'Doe' }]\n    }\n  }\n});\n\n// schema is now ready for graphql execution","lang":"typescript","description":"Shows transpilation of an enriched schema with inheritance to standard GraphQL."},"warnings":[{"fix":"Use destructuring: const { transpileSchema } = require('graphql-s2s').graphqls2s (old) or import { transpileSchema } from 'graphql-s2s' (new).","message":"In v0.16.0, the package switched from default export to named exports. require('graphql-s2s') no longer returns a function.","severity":"breaking","affected_versions":">=0.16.0"},{"fix":"Use named ESM imports or await import('graphql-s2s').","message":"The .graphqls2s property for CommonJS require access is deprecated and may be removed in future versions.","severity":"deprecated","affected_versions":">=0.16.0 <1.0.0"},{"fix":"Always declare all fields in the child type, even if inherited.","message":"Inheritance does not merge fields from parent types automatically; you must manually add fields to the child. The 'inherits' keyword only copies fields at transpile time, not during schema execution.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always use Paged<Question> not just Paged.","message":"Generic types like Paged<T> must be instantiated with a concrete type; generics without instantiation will cause parse errors.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Manually deduplicate or use interface merging patterns.","message":"The transpiled schema may contain duplicate type definitions if multiple inheritance chains have overlapping fields; transpileSchema does not deduplicate.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"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.","cause":"Using old import pattern with newer version that exports directly.","error":"TypeError: Cannot destructure property 'transpileSchema' of 'require(...).graphqls2s' as it is undefined"},{"fix":"Run 'npm install graphql-s2s' and ensure node_modules contains it.","cause":"Package not installed or incorrect path.","error":"Error: Cannot find module 'graphql-s2s'"},{"fix":"Instantiate the generic: type Paged<T> { data: [T] } then type Query { items: Paged<Item> }.","cause":"Generic type used without instantiation (e.g., using Paged in schema without angle brackets).","error":"GraphQLError: Syntax Error: Expected Name, found <EOF>"},{"fix":"Use require('graphql-s2s').graphqls2s.transpileSchema(...) or import the named export.","cause":"Calling require('graphql-s2s') directly as a function in older versions.","error":"TypeError: graphqls2s is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}