Convert JSON objects to MySQL Table Schema, JSON Schema, Mongoose Schema, ClickHouse Schema, Google BigQuery, or a Generic template. Version 2.6.0 is the latest stable release, with infrequent updates. Key differentiator: supports multiple output formats (MySQL, ClickHouse, BigQuery) from a single JSON input, with both CLI and programmatic API. Alternatives like json-schema-generator only output JSON Schema.
npm install generate-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Converts an array of JSON objects to JSON Schema using GenerateSchema.json method.
Always pass a string title as first argument: GenerateSchema.json('Title', data);Use GenerateSchema.mysql('my_table', data); or GenerateSchema.clickhouse('my_table', data, 'date');Use --help or -h for basic options; refer to documentation for detailed flags.
If you need newer draft, consider alternative libraries like jsonschema.
Use 'const GenerateSchema = require("generate-schema")' instead of 'import GenerateSchema from "generate-schema"'.Use 'generate-schema -j data.json' or 'generate-schema --json-schema data.json'.
Provide a title as first argument and ensure data is non-empty: GenerateSchema.json('Title', [{...}]).