{"id":21569448,"url":"https://github.com/naturalcycles/json-schema-lib","last_synced_at":"2026-05-18T03:32:37.408Z","repository":{"id":57129448,"uuid":"393508167","full_name":"NaturalCycles/json-schema-lib","owner":"NaturalCycles","description":"JSON schema to/from TypeScript parser/generator","archived":false,"fork":false,"pushed_at":"2021-10-01T22:55:31.000Z","size":1069,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-08T19:59:01.586Z","etag":null,"topics":["ajv","common-type","json-schema","json-schema-generator","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/NaturalCycles.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-06T21:32:01.000Z","updated_at":"2021-10-01T22:55:32.000Z","dependencies_parsed_at":"2022-09-01T02:10:17.820Z","dependency_job_id":null,"html_url":"https://github.com/NaturalCycles/json-schema-lib","commit_stats":null,"previous_names":["naturalcycles/common-type"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/NaturalCycles/json-schema-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fjson-schema-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fjson-schema-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fjson-schema-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fjson-schema-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NaturalCycles","download_url":"https://codeload.github.com/NaturalCycles/json-schema-lib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalCycles%2Fjson-schema-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271415496,"owners_count":24755639,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ajv","common-type","json-schema","json-schema-generator","typescript"],"created_at":"2024-11-24T11:09:31.972Z","updated_at":"2026-05-18T03:32:37.381Z","avatar_url":"https://github.com/NaturalCycles.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## @naturalcycles/json-schema-lib\n\n\u003e JSON schema to/from TypeScript parser/generator\n\n[![npm](https://img.shields.io/npm/v/@naturalcycles/json-schema-lib/latest.svg)](https://www.npmjs.com/package/@naturalcycles/json-schema-lib)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\nAllows to generate [JSON Schema](https://json-schema.org/) from a set of Typescript files with\nInterfaces (also Types and Enums).\n\nAlso, to generate Typescript files from JSON schemas (reverse).\n\nStatus: experimental! Everything is subject to change!\n\n# Example\n\nInstall `json-schema-lib` as your devDependency:\n\n    yarn add -D @naturacycles/json-schema-lib\n\nDefine a `jsonSchemaGenerator.cfg.js` in the root of you project:\n\n```js\nmodule.exports = {\n  paths: ['src/types/*.ts'],\n  outputDir: 'resources/schemas',\n}\n```\n\nConfig says to scan all `*.ts` files in `src/types`, parse them, generate JSON schemas, write them\ninto `resources/schemas` folder.\n\n## Similar projects\n\n- https://github.com/YousefED/typescript-json-schema\n- https://github.com/vega/ts-json-schema-generator\n\n## Develop\n\nTypescript AST debugging: https://ts-ast-viewer.com/\n\n## Supported\n\n- Schemas from:\n  - Interfaces\n  - Types\n  - Enums\n  - Classes\n- `string`, `number`, `boolean`\n- Literal types, e.g `someString`, 15, `true`\n- `null` type\n- `object`, `array`\n- `tuple`\n- `enum` (`string` and `number` values)\n- optional/required properties\n- Union types (`|`), Intersections (`\u0026`), `extends`\n- jsdoc `@validationType` (e.g. `integer`)\n- Type references, e.g. `p: Person` (where `Person` is defined elsewhere, can be in another file)\n- Parsing a list of files (not necessary for all types to be in 1 file)\n- `Partial`, `Required`\n- `Record\u003cA, B\u003e`\n- Indexed properties (`{ [name: string]: string }`)\n- `StringMap` (aka Dictionary)\n- jsdoc tags:\n  - `validationType` to override `type`, e.g. `@validationType integer`\n  - General: `deprecated`, `readOnly`, `writeOnly`, `default`\n  - String: `pattern`, `format`, `minLength`, `maxLength`\n  - Number: `multipleOf`, `minimum`, `exclusiveMinimum`, `maximum`, `exclusiveMaximum`\n  - Object: `additionalProperties`, `minProperties`, `maxProperties`\n  - Array: `minItems`, `maxItems`, `uniqueItems`\n  - Schema composition: `if`, `then`, `else`, `dependencies`, `dependentRequired`,\n    `dependentSchemas`\n\n## Currently NOT supported\n\n- `Omit`, `Pick`\n- Generic interfaces, e.g. `interface MyType\u003cT\u003e { current: T, future: T }`\n- `typeof`\n- `keyof`\n- Conditional types\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaturalcycles%2Fjson-schema-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaturalcycles%2Fjson-schema-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaturalcycles%2Fjson-schema-lib/lists"}