Transforms GraphQL schema introspection data into a valid JSON Schema (draft-06). Current stable version is 0.10.0, maintained as needed. Key differentiators: supports GraphQL unions, input types, enums, descriptions, default values, nullable array items, and configurable ID scalar mapping. Lightweight with no production dependencies beyond GraphQL itself. Suitable for generating JSON Schema from GraphQL schemas for documentation or validation purposes.
npm install graphql-2-json-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates converting a GraphQL schema to JSON Schema using fromIntrospectionQuery with typical options.
Set nullableArrayItems to true to prepare for future default behavior.
Explicitly set all options to avoid breaking changes when defaults change.
Set ignoreInternals: false if you need types like __Type.
Pass idTypeMapping: 'number' or 'both' in options.
npm install graphql-2-json-schema
Check the current option names; upgrade to latest version.
Ensure you are importing from 'graphql-2-json-schema' and not a subpath.