Registry / serialization / graphql-schema-transpiler

graphql-schema-transpiler

JSON →
library1.0.1jsnpmunverified

A transpiler that extends standard GraphQL schema syntax to support type inheritance among `type`, `input`, and `interface` definitions, allowing single and multiple inheritance to reduce boilerplate. Version 1.0.1 is the latest stable release; no active development or release cadence is documented. Unlike GraphQL tools that rely on code-first approaches or schema stitching, this package operates purely at the schema text level, making it simple to integrate into existing build pipelines. It also supports field type conversion when inheriting between `type` and `input` schemas.

npm install graphql-schema-transpiler
INSTALL
IMPORT
SIG · GRAPHQL-SCHEMA-TRA
G
graphql-schema-transpiler
serializationjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

transpileSchema
import { transpileSchema } from 'graphql-schema-transpiler'
const transpileSchema = require('graphql-schema-transpiler')
Package exports transpileSchema as a named export, not default. CommonJS requires destructuring.
transpileSchema (CommonJS)
const { transpileSchema } = require('graphql-schema-transpiler')
const transpileSchema = require('graphql-schema-transpiler').default
Default export does not exist; use named import via destructuring.
TypeScript import
import { transpileSchema } from 'graphql-schema-transpiler'
Package does not ship TypeScript definitions; use @types/graphql or declare module manually.

Transpile a GraphQL schema with type inheritance to standard GraphQL, creating a new schema string with all inherited fields copied.

import { transpileSchema } from 'graphql-schema-transpiler'; const schema = ` type Person { firstName: String! lastName: String! } type Employee extends Person { jobTitle: String! } `; const transpiled = transpileSchema(schema, { addMissingTypesAndInputs: true, }); console.log(transpiled); /* Output: type Person { firstName: String! lastName: String! } type Employee { jobTitle: String! firstName: String! lastName: String! } */
graphql-schema-transpiler --version
Debug
Known issues
gotchaField type conversion from output to input types when inheriting from type to input may produce unexpected results if unmapped fields exist.
fix
Check generated input types for correctness; use `addMissingTypesAndInputs: false` to skip auto-conversion.
affects: >=1.0.0
gotchaCircular inheritance (e.g., type A extends B, B extends A) may cause infinite recursion or stack overflow.
fix
Avoid circular dependencies; validate schema before transpilation.
affects: >=1.0.0
gotchaMultiple inheritance order matters: fields from later parents may override earlier ones if duplicates exist. Not explicitly documented.
fix
Ensure field names are unique across parent types or rely on first-come-first-served behavior.
affects: >=1.0.0
gotchaInput types inherited from type definitions may lose non-null constraints if child specifies default values.
fix
Review generated input types for nullability changes; override fields explicitly.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'graphql-schema-transpiler' or its corresponding type declarations.
Package lacks TypeScript type definitions; TypeScript strict mode might not resolve module.
fix
Install @types/graphql or add custom typings: declare module 'graphql-schema-transpiler';
Uncaught TypeError: transpileSchema is not a function
CommonJS require used without destructuring, or wrong import syntax.
fix
Use const { transpileSchema } = require('graphql-schema-transpiler'); or import { transpileSchema } from 'graphql-schema-transpiler';
Maximum call stack size exceeded
Circular inheritance in schema definition.
fix
Remove circular extends clauses from schema types.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
graphql-schema-transpiler — npm install graphql-schema-transpiler · libregistry