Parse SQL DDL statements and convert them to JSON Schema documents and a compact JSON format. Version 6.0.0 supports Node.js >=16 <=24 and ships TypeScript types. Key differentiators: handles multiple SQL dialects, produces both JSON Schema (draft-07) and a compact intermediate format, supports ALTER TABLE, and allows configuration of output options like useRef for schema references. Active development with regular releases.
npm install sql-ddl-to-json-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a SQL DDL statement and outputs an array of JSON Schema documents.
Use import syntax or configure your project for ESM.
Use import { parseSqlToJsonSchema } from 'sql-ddl-to-json-schema' instead of import sqlDdlToJsonSchema from 'sql-ddl-to-json-schema'.If using newer JSON Schema versions, post-process the output or use compact format and convert manually.
Use Node.js version between 16 and 24, or consider using an older version of the package.
Add "type": "module" to your package.json or use .mjs extension.
Ensure you are importing from 'sql-ddl-to-json-schema' and using the correct export name. Check version compatibility.
Verify the SQL string contains valid DDL statements (e.g., CREATE TABLE).