{"_id":"@stoplight/json-schema-generator","_rev":"34-68491c07f101c7f9304dc3b4bd4f8707","name":"@stoplight/json-schema-generator","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@stoplight/json-schema-generator","version":"1.0.0","keywords":["json schema","json schema generator","schema","json","generator","draft","v4"],"author":{"name":"Stoplight","email":"support@stoplight.io"},"license":"MIT","_id":"@stoplight/json-schema-generator@1.0.0","maintainers":[{"name":"naumanali__","email":"mnaumanali94@gmail.com"},{"name":"marcelltoth","email":"marcell@marcelltoth.net"},{"name":"zee-hussain","email":"zee@stoplight.io"},{"name":"falsaffa_stoplight","email":"feras@stoplight.io"},{"name":"johnrazmus","email":"john@razmus.net"},{"name":"cappslock","email":"eric@decentmammal.com"},{"name":"mmiask","email":"michael@stoplight.io"},{"name":"paulatulis","email":"paula@stoplight.io"},{"name":"ssspear","email":"sarah@stoplight.com"},{"name":"p0lip","email":"jakub@rozek.tech"},{"name":"stefandywersant","email":"karol.maciaszek@gmail.com"},{"name":"mallachari","email":"mallachari@gmail.com"},{"name":"philsturgeon","email":"me@philsturgeon.uk"},{"name":"wmhilton","email":"wmhilton@gmail.com"},{"name":"maggot999","email":"mateuszwit21@gmail.com"},{"name":"vincenzo","email":"vincenz.chianese@icloud.com"},{"name":"chris.miaskowski","email":"itbitescode@gmail.com"},{"name":"lottamus","email":"chrisnlott@gmail.com"},{"name":"rossmcd","email":"npm@rossmcdonald.me"},{"name":"chohmann","email":"chelsea.hohmann@gmail.com"},{"name":"dcbachi","email":"collin@stoplight.io"},{"name":"vazha","email":"rainum.ua@gmail.com"},{"name":"pytlesk4","email":"tom@stoplight.io"},{"name":"marbemac","email":"marbemac@gmail.com"}],"homepage":"https://github.com/stoplightio/json-schema-generator","bugs":{"url":"https://github.com/stoplightio/json-schema-generator/issues"},"bin":{"json-schema-generator":"bin/cli.js"},"dist":{"shasum":"d44af3e5bd2a0986d5d46cf28e26bed82eed4787","tarball":"https://registry.npmjs.org/@stoplight/json-schema-generator/-/json-schema-generator-1.0.0.tgz","fileCount":12,"integrity":"sha512-x7qi4s6uTSpBfutYBNTMy04eekDJkWuowVBm3QARig2bRqtZXKORcLv1OhYEQILw+HOKLdRcBzumoHbk1UZIGg==","signatures":[{"sig":"MEYCIQCuDRrVsDdDb2ZuKzp1zD9EQk04GUCKa7Gd9ZZ9nP2LIQIhAPqkIIpe+YEwVGWraZZT4Vz+wORsR03J5ePXJ/RrGUCh","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26304,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfbeEjCRA9TVsSAnZWagAAYdgP/1iwv2BDXG7mT4ixJ86w\ndA0dZm41jBWQEfpdRn+J3SRyFbIrGi5EUo4/BwmEjxRO3hhES7uBUK+jlx4m\njyGditBi2cCp8nVN3DNwpKcdQMFu4jHgXSA6vxuyy88xFJjFX9Zb8aNp+IIT\nfnO/bBP1ygQu4iJU/QGxYuT9E98iZ8TBmIt1JTrs4zptoFScTbh1yuHFGEqH\nrAdrCNCwCUz2ikuQa63i9TkI8JMWcY9YI3q+Txvp0PeYujeYUHwFb5RJJZzD\nqiBbPeH0oXkov3R9FNBuQqQysPi8YEjViEG03puPE/Phg2u2cBArd+r/Dkqz\nlHocD7CsZY1j2lC70fEIZhgoFCAck0Kx54UDq19vDITgfLsfCGp94jq61hXf\nOKzl8QP+JbYSOFyNSh1wEDcp4lr9q9DNANAvWmpj95m/BbrG7lp2yvJVE3ZZ\nkwLAUwU2KRicXwvlM3QT3+gEClyQaN5LgpJ5HcIRqsuM/uoMXJGHdDoL0AjN\nqzj4n6x8B81KOc0iwymxbCJw+lQx5yl5DKfmNeRIFXLj1vTVYQMATgLF8sKM\nSkdhP6boiIk01Bz/qBlo/jqgE/hpRqrQEHM0LhOJBGLipWAiTNMuDcXhlulN\nppc5wVDSJrOgmA5zC8WxLO9A1BvYkCk7NnWVE+RkpRFSYKdFjUuq4ZHA3HDc\nJJAY\r\n=MzaH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"gitHead":"46272bbdf9033944b5fc0694190c9dab20501d54","release":{"extends":"@stoplight/scripts/release","pkgRoot":"."},"scripts":{"test":"mocha","release":"semantic-release"},"_npmUser":{"name":"marbemac","email":"marbemac@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/stoplightio/json-schema-generator.git","type":"git"},"_npmVersion":"6.14.8","description":"JSON schema generator based on draft-v4.","directories":{},"_nodeVersion":"12.18.4","dependencies":{"mkdirp":"0.5.x","request":"2.x.x","optimist":"0.6.x","pretty-data":"0.40.x","json-promise":"1.1.x"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^1.9.2","mocha":"^8.1.3","coveralls":"^2.11.2","@commitlint/cli":"^11.0.0","chai-json-schema":"^1.1.0","@stoplight/scripts":"^8.2.1","@commitlint/config-conventional":"^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/json-schema-generator_1.0.0_1601036579391_0.31183813822817896","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@stoplight/json-schema-generator","version":"1.0.1","keywords":["json schema","json schema generator","schema","json","generator","draft","v4"],"author":{"name":"Stoplight","email":"support@stoplight.io"},"license":"MIT","_id":"@stoplight/json-schema-generator@1.0.1","maintainers":[{"name":"stoplight-devops","email":"devops@stoplight.io"}],"homepage":"https://github.com/stoplightio/json-schema-generator","bugs":{"url":"https://github.com/stoplightio/json-schema-generator/issues"},"bin":{"json-schema-generator":"bin/cli.js"},"dist":{"shasum":"ae4c9db389ec98e849055fae842553822797721d","tarball":"https://registry.npmjs.org/@stoplight/json-schema-generator/-/json-schema-generator-1.0.1.tgz","fileCount":12,"integrity":"sha512-b9WT8Z5M7Nc/O6+JVEMvOdkLR1fePbCHnPlOpnRFxp+pkfM+VRwLaD4toWRpnpBlHXphRfDxFj5/zxcVvqeKDA==","signatures":[{"sig":"MEQCIGStPdruh5FRrZtHMNk0vSVFzQ3qyVoVMLUyT37sIWZ8AiA97LPSHCiBqeflscDsGVrAS/BKf20tXBlfz7zKlFj+wg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26228,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiWXM2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq4pA/8CFchdnuiZBa4s5vgcm/siyApY45IPq7l7NuSQf2h5zh93FiL\r\n2vA8xhxKodiyephrZ4hT7XiLsDyTajBFXhtbXfI5uw33V8t6XARpQixvkvQJ\r\n1NSRQQJ3rdPJW/u5ap6ZP+tup380dYN/wEYxGErB7wdauOrZE3XeYff/3yFa\r\nHxIcoiIoPa1UOX0KcXfsjHZeF+jSbq6/GbjXj9BFzgmRftSdKex26Sy892xb\r\nwlkchuWyzXmSzov/DGx/AQ3BhQShHv62L+opHMjYzssNnxM1nbYK5K5gv41E\r\nm05nGE0E0kH7XNha7s0VqJBve2O3DCu0ZVEsCidybD7bP59v2kXl9P6ubZlo\r\nw91UzDmiQqLxbSZW7IFoiDtcNOaLJDeskg6TBOLXAsNXKxdF4yWsyf7G50Fk\r\nydMMxXXVhn0Z4m+BkuDERZ5SzXL2uiAqk6NJg1HytI3tcwOwkck9qjARjsH4\r\nyIklp9V5doTuMCkwv0PvA2MOLXN54EKZAcncrmJ1tWGwxdSQ7hC/ipyP7qat\r\nSSQUoQoeW94OBjiVAQgHRAhi503MjbXmCcFVQJ+6tsn68lSjrZ1GUWSNnWPz\r\neno0zAs7Dw3TGGzABvvTY2QcabbmLkpr0PyhzN03eJC5Dc4lwTzvFE5Lt+Xi\r\nWv/TwNG3YhbRiXvQK8qxt82yRX+ukzqW954=\r\n=GMSU\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"gitHead":"0683e6bd1bf799bcc1a8a636528fe07b81c81cee","release":{"extends":"@stoplight/scripts/release","pkgRoot":"."},"scripts":{"test":"mocha","release":"semantic-release"},"_npmUser":{"name":"stoplight-devops","email":"devops@stoplight.io"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/stoplightio/json-schema-generator.git","type":"git"},"_npmVersion":"6.14.8","description":"JSON schema generator based on draft-v4.","directories":{},"_nodeVersion":"12.22.7","dependencies":{"mkdirp":"0.5.x","request":"2.x.x","minimist":"1.2.6","pretty-data":"0.40.x","json-promise":"1.1.x"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^1.9.2","mocha":"^8.1.3","coveralls":"^2.11.2","@commitlint/cli":"^11.0.0","chai-json-schema":"^1.1.0","@stoplight/scripts":"^8.2.1","@commitlint/config-conventional":"^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/json-schema-generator_1.0.1_1650029366470_0.9949552387402991","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@stoplight/json-schema-generator","version":"1.0.2","keywords":["json schema","json schema generator","schema","json","generator","draft","v4"],"author":{"name":"Stoplight","email":"support@stoplight.io"},"license":"MIT","_id":"@stoplight/json-schema-generator@1.0.2","maintainers":[{"name":"stoplight-devops","email":"devops@stoplight.io"}],"homepage":"https://github.com/stoplightio/json-schema-generator","bugs":{"url":"https://github.com/stoplightio/json-schema-generator/issues"},"bin":{"json-schema-generator":"bin/cli.js"},"dist":{"shasum":"9db1b05bc6c79f7dd5bdab86985ed9eccc964d93","tarball":"https://registry.npmjs.org/@stoplight/json-schema-generator/-/json-schema-generator-1.0.2.tgz","fileCount":12,"integrity":"sha512-FzSLFoIZc6Lmw3oRE7kU6YUrl5gBmUs//rY59jdFipBoSyTPv5NyqeyTg5mvT6rY1F3qTLU3xgzRi/9Pb9eZpA==","signatures":[{"sig":"MEUCIQCQD56dDt4YnVUQ8COGcWe2fI+Is2PwsjcANHWv4T0C4AIgZXuAhNdVJniiP/V9UPZmdFv4KNDVtTfvi6p6kEXb4No=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":26604,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGduZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpe+Q/+IypZlbzxJBYgWtUk6UMgsySw0xcPq8tc5f1I14VFpDTYNihU\r\nTLBs9Z3V4fS0/n4blYdwtRj3QlizT5POgjD5cReosB5/XhchZO/PrWqNzUUE\r\nqjoI9t6KcAwSUI9DENCdz+WpiLBrzdpETC6iZ8krjp9Y1hTCgGK/DUQmoGvB\r\nacf3m7tizrEyQmmUKfJn2f0z58SLLXJ9IU/2iwacgnM8hV4VwWwnLnVmVaB4\r\nRYgg6tFdV9JRxSaBt73pkAGEJyu/QgaOqGKa4FL/ntjO4tkzybDCCRz4r5mK\r\nuDe956lVQz+/yrlG+Zrg3IIMWKYShaPZfYzXwPfkm6gSlDGcA5fLexDBJzgN\r\nkiKmQPQyOGbDbhTc1CtnTKJnAK7I9aXHrd+un+IHJd8rEOpvKTLuqvtRPcWC\r\nU6KE4K8BZPU59+DKnfljJnVBYtHnwpPCtN2dvrFvrSa76GZiv8dSQmnq5mGQ\r\nt7A5Hxj4zbtM7kTSh6KCMPX7GI58AhliWJLyNK73yRasnkIEsszlHoJopuO4\r\nHVWfDcaeEdYSjl0/q6elziqMn4YqBYrqBCS/CSgqDqGea3I/nB38ybnoauOs\r\nWEEDp94ILD0R2RIkZGBfeUVo1OiuKFU7j3xf1z22Ug9pz+mji1WnBRzJWLnK\r\nSgm5F+SqTe+3l+Wch04gzVzrmpJ+Qr+sCbs=\r\n=eBK+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"gitHead":"5e362d0007f2550bfa1e319c2ba7335896ff65ad","release":{"extends":"@stoplight/scripts/release","pkgRoot":"."},"scripts":{"test":"mocha","release":"semantic-release"},"_npmUser":{"name":"stoplight-devops","email":"devops@stoplight.io"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/stoplightio/json-schema-generator.git","type":"git"},"_npmVersion":"6.14.17","description":"JSON schema generator based on draft-v4.","directories":{},"_nodeVersion":"16.13.1","dependencies":{"mkdirp":"0.5.x","minimist":"1.2.6","cross-fetch":"^3.1.5","pretty-data":"0.40.x","json-promise":"1.1.x"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^1.9.2","mocha":"^8.1.3","express":"^4.18.1","coveralls":"^2.11.2","@commitlint/cli":"^11.0.0","chai-json-schema":"^1.1.0","@stoplight/scripts":"^8.2.1","@commitlint/config-conventional":"^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/json-schema-generator_1.0.2_1662639000928_0.45958068378617223","host":"s3://npm-registry-packages"}}},"time":{"created":"2020-09-25T12:22:59.390Z","modified":"2025-07-18T12:05:29.696Z","1.0.0":"2020-09-25T12:22:59.554Z","1.0.1":"2022-04-15T13:29:26.622Z","1.0.2":"2022-09-08T12:10:01.150Z"},"bugs":{"url":"https://github.com/stoplightio/json-schema-generator/issues"},"author":{"name":"Stoplight","email":"support@stoplight.io"},"license":"MIT","homepage":"https://github.com/stoplightio/json-schema-generator","keywords":["json schema","json schema generator","schema","json","generator","draft","v4"],"repository":{"url":"git+https://github.com/stoplightio/json-schema-generator.git","type":"git"},"description":"JSON schema generator based on draft-v4.","maintainers":[{"email":"devops@stoplight.io","name":"stoplight-devops"},{"email":"matthew.runkle@smartbear.com","name":"mrunkle-sb"},{"email":"devops@smartbear.com","name":"smartbear_devops"}],"readme":"json-schema-generator\n=====================\n\nJSON schema generated based on draft-v4 of the specification. Note that the full spec if not yet supported. The compiler will be enhanced to support as much as possible. More specifically, there's no support for $ref nodes or special nodes like location (lat, long), etc. These features will be added in future releases or you can always fork and make it better :-)\n\n\n### Install (GIT)\n```bash\ngit clone https://github.com/krg7880/json-schema-generator\ncd json-schema-generator\nnpm install .\n```\n\n### Install as cli (NPM)\nRun on the command line:\n\n```bash\nnpm install -g json-schema-generator\n```\n\nThen use (for example):\n\n```bash\n#### JSON PATH\njson-schema-generator path/to/input.json -o path/to/output.json\n#### JSON URL\njson-schema-generator https://sample.com/path/to/input.json --jsondir ./source/backup -o ./path/to/dir/\n#### JSON STDIN | STDOUT\ncat input.json | json-schema-generator > output.json\n```\n\n### Install as lib (NPM)\nRun on the command line:\n\n```bash\nnpm install json-schema-generator --save-dev\n```\n\nThen, in your project:\n\n```javascript\nvar jsonSchemaGenerator = require('json-schema-generator'),\n    obj = { some: { object: true } },\n    schemaObj;\n\nschemaObj = jsonSchemaGenerator(json);\n```\n\n### Cli usage\n```\nUsage: json-schema-generator [<target>|--url <url>|--file <file>|--stdin]\n\nIf <target> is specified, it is interpreted as follows: a protocol (like http://) \nmeans url; anything else is treated as path to a local file. \nIf no input file is specified and stdin is provided, stdin is used.\n\nOptions:\n  --stdin          Use stdin as input.                                              \n  --url            Remote json document to use as input.                            \n  --file           Local json document to use as input.                             \n  --schemadir, -o  Directory (or file, if ending with .json) where the schema will\n                   be stored.                                                       \n  --jsondir        Directory (or file, if ending with .json) where the source\n                   document is copied to. Useful with --url.                        \n  --pretty         Whether to use pretty json format. Use --no-pretty for false.\n                                                                     [default: true]\n  --force, -f      If a destination file already exists, overwrite it.              \n  --help, -h       Show this help text.                                             \n\n```\n\n#### Example JSON\n```json\n{\n    \"title\": \"fresh fruit schema v1\",\n    \"type\": \"object\",\n    \"required\": [\"skin\", \"colors\", \"taste\"],\n    \"properties\": {\n        \"colors\": {\n            \"type\": \"array\",\n            \"minItems\": 1,\n            \"uniqueItems\": true,\n            \"items\": {\n                \"type\": \"string\"\n            }\n        },\n        \"skin\": {\n            \"type\": \"string\"\n        },\n        \"taste\": {\n            \"type\": \"number\",\n            \"minimum\": 5\n        }\n    }\n}\n```\n\n\n#### Example Output\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n  \"description\": \"\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"title\": {\n      \"type\": \"string\",\n      \"minLength\": 1\n    },\n    \"type\": {\n      \"type\": \"string\",\n      \"minLength\": 1\n    },\n    \"required\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"required\": [\n          \n        ],\n        \"properties\": {\n          \n        }\n      }\n    },\n    \"properties\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"colors\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\",\n              \"minLength\": 1\n            },\n            \"minItems\": {\n              \"type\": \"number\"\n            },\n            \"uniqueItems\": {\n              \"type\": \"boolean\"\n            },\n            \"items\": {\n              \"type\": \"object\",\n              \"properties\": {\n                \"type\": {\n                  \"type\": \"string\",\n                  \"minLength\": 1\n                }\n              },\n              \"required\": [\n                \"type\"\n              ]\n            }\n          },\n          \"required\": [\n            \"type\",\n            \"minItems\",\n            \"uniqueItems\",\n            \"items\"\n          ]\n        },\n        \"skin\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\",\n              \"minLength\": 1\n            }\n          },\n          \"required\": [\n            \"type\"\n          ]\n        },\n        \"taste\": {\n          \"type\": \"object\",\n          \"properties\": {\n            \"type\": {\n              \"type\": \"string\",\n              \"minLength\": 1\n            },\n            \"minimum\": {\n              \"type\": \"number\"\n            }\n          },\n          \"required\": [\n            \"type\",\n            \"minimum\"\n          ]\n        }\n      },\n      \"required\": [\n        \"colors\",\n        \"skin\",\n        \"taste\"\n      ]\n    }\n  },\n  \"required\": [\n    \"title\",\n    \"type\",\n    \"required\",\n    \"properties\"\n  ]\n}\n```\n\n### Background\nI created this schema generator to validate JSON responses from APIs. As the JSON API is enhanced and nodes are added or removed from the response, the schema is regenerated and validated against the newly deployed API.\n\n### Tests\nTo run tests, including fetching documents via HTTP, we've added [node-stubby-server-cli](https://github.com/krg7880/node-stubby-server-cli) to help with serving mock data. The ports for the stub server is defined under *test/helpers/stubby-cli*, in the event the default port is in use, you can change them there.\n\n```bash\nnpm install -g stubby\n```\n\nInstall [mocha](https://github.com/mochajs/mocha) globally (as cli) and run \n\n```bash\nnpm test\n```\n\n### Validating Documents\nJSON documents can be validated against schemas using [chai-json-schema](http://chaijs.com/plugins/chai-json-schema). See the tests under [test](https://github.com/krg7880/json-schema-generator/tree/master/test) for example usage.\n\n### Contributors\nThanks to those who have contributed. These kind folks are listed below:\n\n* [nickyout](https://github.com/nickyout)\n* [Edward Silverton](https://github.com/edsilv)\n* [Tschef](https://github.com/Tschef)\n\n\n","readmeFilename":"README.md"}