{"id":18391451,"url":"https://github.com/figadore/json-schema-generator","last_synced_at":"2025-07-29T18:12:25.034Z","repository":{"id":143810640,"uuid":"64161540","full_name":"figadore/json-schema-generator","owner":"figadore","description":null,"archived":false,"fork":false,"pushed_at":"2016-10-13T22:00:57.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T05:12:27.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/figadore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-25T19:19:41.000Z","updated_at":"2018-02-28T05:48:34.000Z","dependencies_parsed_at":"2023-07-19T01:15:57.628Z","dependency_job_id":null,"html_url":"https://github.com/figadore/json-schema-generator","commit_stats":null,"previous_names":["shinymayhem/json-schema-generator"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figadore%2Fjson-schema-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figadore%2Fjson-schema-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figadore%2Fjson-schema-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/figadore%2Fjson-schema-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/figadore","download_url":"https://codeload.github.com/figadore/json-schema-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248548783,"owners_count":21122765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T01:51:54.636Z","updated_at":"2025-04-12T09:39:42.193Z","avatar_url":"https://github.com/figadore.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#JSON Schema Generator\n\nGenerate/compile .yaml files (not .yml at the moment) into a single JSON schema file. Resolves references to other schema docuements in the same directory\n\nRequires Node \u003e= 5.0\n\n## Usage\n\n### cli\n```\nnpm install -g @shinymayhem/json-schema-generator\n\nschemagen ./schemas/car.yaml\n```\n\n### module\n```\nvar generator = require(\"@shinymayhem/json-schema-generator\");\n\ngenerator.generate('test/data/car.yaml', function onGenerated(err, schema) {\n  if (err) {\n    throw err;\n  }\n  console.log(schema);\n});\n```\n\n## Examples\n\n### Input\nwindow.yaml\n```\n---\n$schema: http://json-schema.org/draft-04/hyper-schema\nid: window\ntitle: Window\nstrictProperties: true\nadditionalProperties: false\ndefinitions:\n  style:\n    type:\n      - string\n    enum:\n      - georgian\n      - center bar\ntype:\n  - object\nrequired:\n  - size\n  - style\nproperties:\n  style:\n    $ref: window#/definitions/style\n  size:\n    $ref: size\n```\n\nsize.yaml\n```\n---\n$schema: http://json-schema.org/draft-04/hyper-schema\nid: size\ntitle: Size\ndescription: Length and width\nstrictProperties: true\nadditionalProperties: false\ndefinitions:\n  width:\n    type: integer\n    minimum: 1\n    maximum: 100\n  height:\n    type: integer\n    minimum: 1\n    maximum: 100\n  units:\n    type: string\n    enum:\n      - inches\n      - centimeters\ntype:\n  - object\nrequired:\n  - width\n  - height\n  - units\nproperties:\n  height:\n    $ref: size#/definitions/height\n  width:\n    $ref: size#/definitions/width\n  units:\n    $ref: size#/definitions/units\n```\n\n### Run it\n```\nschemagen ./window.yaml\n```\n\n### Output\n```\n{  \n   \"$schema\":\"http://json-schema.org/draft-04/hyper-schema\",\n   \"id\":\"window\",\n   \"title\":\"Window\",\n   \"strictProperties\":true,\n   \"additionalProperties\":false,\n   \"definitions\":{  \n      \"style\":{  \n         \"type\":[  \n            \"string\"\n         ],\n         \"enum\":[  \n            \"georgian\",\n            \"center bar\"\n         ]\n      },\n      \"size\":{  \n         \"$schema\":\"http://json-schema.org/draft-04/hyper-schema\",\n         \"id\":\"size\",\n         \"title\":\"Size\",\n         \"description\":\"Length and width\",\n         \"strictProperties\":true,\n         \"additionalProperties\":false,\n         \"definitions\":{  \n            \"width\":{  \n               \"type\":\"integer\",\n               \"minimum\":1,\n               \"maximum\":100\n            },\n            \"height\":{  \n               \"type\":\"integer\",\n               \"minimum\":1,\n               \"maximum\":100\n            },\n            \"units\":{  \n               \"type\":\"string\",\n               \"enum\":[  \n                  \"inches\",\n                  \"centimeters\"\n               ]\n            }\n         },\n         \"type\":[  \n            \"object\"\n         ],\n         \"required\":[  \n            \"width\",\n            \"height\",\n            \"units\"\n         ],\n         \"properties\":{  \n            \"height\":{  \n               \"$ref\":\"#/definitions/size/definitions/height\"\n            },\n            \"width\":{  \n               \"$ref\":\"#/definitions/size/definitions/width\"\n            },\n            \"units\":{  \n               \"$ref\":\"#/definitions/size/definitions/units\"\n            }\n         }\n      }\n   },\n   \"type\":[  \n      \"object\"\n   ],\n   \"required\":[  \n      \"size\",\n      \"style\"\n   ],\n   \"properties\":{  \n      \"style\":{  \n         \"$ref\":\"#/definitions/style\"\n      },\n      \"size\":{  \n         \"$ref\":\"#/definitions/size\"\n      }\n   }\n}\n```\n\n### Valid data\n```\n{\n  \"style\": \"georgian\",\n  \"size\": {\n    \"width\": 32,\n    \"height\": 32,\n    \"units\": \"inches\"\n  }\n}\n```\n\n\nAlternatively, see 'test/data' dir for example schema files\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffigadore%2Fjson-schema-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffigadore%2Fjson-schema-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffigadore%2Fjson-schema-generator/lists"}