{"id":47890,"library":"graphql-json-schema","title":"graphql-json-schema","description":"Converts GraphQL Schema Language (SDL) to JSON Schema (draft-04). Stable version 0.1.2, low release cadence. Differentiates by enabling reuse of GraphQL type definitions in JSON Schema contexts; outputs definitions with GraphQL-specific constructs (e.g., GRAPHQL_SCALAR, GRAPHQL_UNION) rather than fully standard JSON Schema, which may require post-processing.","status":"active","version":"0.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/jakubfiala/graphql-json-schema","tags":["javascript","graphql","json-schema"],"install":[{"cmd":"npm install graphql-json-schema","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-json-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-json-schema","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package exports a single default function; named import will be undefined.","wrong":"const { transform } = require('graphql-json-schema');","symbol":"transform (default)","correct":"import transform from 'graphql-json-schema';"},{"note":"default export is not wrapped in an object.","wrong":"const { default: transform } = require('graphql-json-schema');","symbol":"transform (CommonJS)","correct":"const transform = require('graphql-json-schema');"},{"note":"No type definitions shipped; use @types/graphql-json-schema or declare module.","wrong":"","symbol":"TypeScript types","correct":"import transform from 'graphql-json-schema';"}],"quickstart":{"code":"import transform from 'graphql-json-schema';\n\nconst schema = transform(`\n  type Query {\n    hello: String!\n  }\n`);\n\nconsole.log(JSON.stringify(schema, null, 2));","lang":"javascript","description":"Shows basic usage: convert GraphQL SDL string to JSON Schema object and print it."},"warnings":[{"fix":"Post-process the output to replace custom types with standard ones, or use a tool that understands these extensions.","message":"Output JSON Schema uses custom types like GRAPHQL_SCALAR, GRAPHQL_UNION, GRAPHQL_ENUM which are not standard JSON Schema types and may not validate with standard validators.","severity":"gotcha","affected_versions":"<=0.1.2"},{"fix":"Use a validator that supports draft-04, or convert the output to a later draft.","message":"The output schema uses JSON Schema draft-04 ($schema: http://json-schema.org/draft-04/schema#), which is outdated and may not be compatible with newer validators.","severity":"gotcha","affected_versions":"<=0.1.2"},{"fix":"Define explicit mapping for custom scalars if needed after conversion.","message":"GraphQL scalars are transformed to JSON Schema type 'integer' for Int, 'number' for Float, etc. but custom scalars become GRAPHQL_SCALAR with no type mapping.","severity":"gotcha","affected_versions":"<=0.1.2"},{"fix":"Consider alternative libraries like graphql-2-json-schema or graphql-schema-to-json-schema.","message":"Package is rarely updated; last release 0.1.2 (unclear date). Future compatibility with newer GraphQL spec or JSON Schema drafts is uncertain.","severity":"deprecated","affected_versions":"<=0.1.2"}],"env_vars":null,"search_vec":"'-04':14 '0.1.2':17 'cadenc':20 'construct':39 'context':32 'convert':5 'definit':28,34 'differenti':21 'draft':13 'e.g':40 'enabl':23 'fulli':47 'graphql':2,6,26,37,41,43,58 'graphql-json-schema':1 'graphql-specif':36 'javascript':57 'json':3,11,30,49,60 'json-schema':59 'languag':8 'low':18 'may':52 'output':33 'post':55 'post-process':54 'process':56 'rather':45 'releas':19 'requir':53 'reus':24 'scalar':42 'schema':4,7,12,31,50,61 'sdl':9 'specif':38 'stabl':15 'standard':48 'type':27 'union':44 'version':16","created_at":"2026-06-07T16:53:51.154678+00:00","updated_at":"2026-06-07T16:53:51.154678+00:00","problems":[{"fix":"Run 'npm install graphql-json-schema' and ensure import statement matches CommonJS or ESM pattern.","cause":"Package not installed or import path incorrect.","error":"Cannot find module 'graphql-json-schema'"},{"fix":"Use default import: import transform from 'graphql-json-schema' or const transform = require('graphql-json-schema').","cause":"Used named import { transform } instead of default import.","error":"TypeError: transform is not a function"},{"fix":"Use a valid JSON Schema draft-04 validator, or remove the $schema property from output.","cause":"Output uses draft-04 $schema, but validator expects later draft.","error":"Schema is not valid: data[\"$schema\"] must be equal to one of the allowed values"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jakubfiala/graphql-json-schema#readme","github":"https://github.com/jakubfiala/graphql-json-schema","docs":null,"changelog":null,"pypi":null,"npm":"graphql-json-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}