Gathering detailed insights and metrics for generate-schema
Gathering detailed insights and metrics for generate-schema
Gathering detailed insights and metrics for generate-schema
Gathering detailed insights and metrics for generate-schema
prisma-generate-schema
Transform prisma datamodel SDL into graphql-js SDL
ts-json-schema-generator
Generate JSON schema from your Typescript sources
json-schema-defaults
Generate JSON object from default values in JSON Schema
generate-schema-default-value
Effortlessly convert your JSON Object to JSON Schema, Mongoose Schema, or a Generic template for quick documentation / upstart.
🧞 Convert JSON Objects to MySQL, JSON Schema, Mongoose, Google BigQuery, Swagger, and more.
npm install generate-schema
Typescript
Module System
Node Version
NPM Version
99.6
Supply Chain
100
Quality
75.5
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
12,806,999
Last Day
14,537
Last Week
71,845
Last Month
297,870
Last Year
3,185,855
1,042 Stars
77 Commits
136 Forks
25 Watching
2 Branches
13 Contributors
Minified
Minified + Gzipped
Latest Version
2.6.0
Package Id
generate-schema@2.6.0
Size
10.20 kB
NPM Version
5.5.1
Node Version
7.9.0
Publised On
20 Nov 2017
Cumulative downloads
Total Downloads
Last day
8.5%
14,537
Compared to previous day
Last week
-11%
71,845
Compared to previous week
Last month
14.4%
297,870
Compared to previous month
Last year
12.9%
3,185,855
Compared to previous year
2
Convert JSON Objects to MySQL Table Schema, JSON Schema, Mongoose Schema, ClickHouse Schema, Google BigQuery, or a Generic template for documentation, code generation, and more.
Install with npm:
1$ npm i --save generate-schema
Optionally, add -g
to the above if you want the generate-schema
command line executable.
Usage: generate-schema [options ...] [file]
Common Options:
-h, --help output usage information
-V, --version output the version number
-q, --quiet Skip help message in program output
Mode Options:
-g, --generic Generic JSON Primitives schema output
-j, --json-schema JSON Schema output
-s, --mysql MySQL Table Schema output
-m, --mongoose Mongoose Schema output
-b, --big-query Google BigQuery Schema output
-c, --clickhouse Clickhouse Table Schema output
When no file is specified, generate-schema
enters a REPL mode.
$ generate-schema -b
generate-schema v2.5.1 (bigquery)
Type "exit" to quit.
Type {a:"b"} to see an example.
> {a:"b"}
[
{
"name": "a",
"type": "STRING",
"mode": "NULLABLE"
}
]
1var GenerateSchema = require('generate-schema')
// Capture Schema Output
var schema = GenerateSchema.json('Product', [
{
"id": 2,
"name": "An ice sculpture",
"price": 12.50,
"tags": ["cold", "ice"],
"dimensions": {
"length": 7.0,
"width": 12.0,
"height": 9.5
},
"warehouseLocation": {
"latitude": -78.75,
"longitude": 20.4
}
},
{
"id": 3,
"name": "A blue mouse",
"price": 25.50,
"dimensions": {
"length": 3.1,
"width": 1.0,
"height": 1.0
},
"warehouseLocation": {
"latitude": 54.4,
"longitude": -32.7
}
}
])
Outputs:
1{ 2 "$schema": "http://json-schema.org/draft-04/schema#", 3 "title": "Product Set", 4 "type": "array", 5 "items": { 6 "type": "object", 7 "properties": { 8 "id": { 9 "type": "number" 10 }, 11 "name": { 12 "type": "string" 13 }, 14 "price": { 15 "type": "number" 16 }, 17 "tags": { 18 "type": "array", 19 "items": { 20 "type": "string" 21 } 22 }, 23 "dimensions": { 24 "type": "object", 25 "properties": { 26 "length": { 27 "type": "number" 28 }, 29 "width": { 30 "type": "number" 31 }, 32 "height": { 33 "type": "number" 34 } 35 } 36 }, 37 "warehouseLocation": { 38 "type": "object", 39 "properties": { 40 "latitude": { 41 "type": "number" 42 }, 43 "longitude": { 44 "type": "number" 45 } 46 } 47 } 48 }, 49 "required": [ 50 "id", 51 "name", 52 "price", 53 "dimensions", 54 "warehouseLocation" 55 ], 56 "title": "Product" 57 } 58}
g.generic(Object object)
Generates a generic schema from object
. Property types are described using primitives.
g.mysql([String tableName,] Mixed object)
Generates MySQL Table Schema from object
.
tableName
is optional, defaults to generic
object
must be of type Object
or Array
g.json([String title,] Mixed object)
Generates JSON Schema from object
.
title
is optionalobject
must be of type Object
or Array
g.mongoose(Object object)
Generates a Mongoose Schema from object
.
g.bigquery(Object object)
Generates a Google BigQuery schema from object
.
g.clickhouse([String tableName,] Mixed object, String dateField)
Generates ClickHouse Table Schema from object
.
tableName
is optional, defaults to generic
object
must be of type Object
or Array
dateField
Date field for ENGINE, must be of type Date
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 8/24 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More