{"id":35616242,"url":"https://github.com/cnfatal/schema-ts","last_synced_at":"2026-01-16T11:58:57.366Z","repository":{"id":330983585,"uuid":"1122168247","full_name":"cnfatal/schema-ts","owner":"cnfatal","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-14T15:40:43.000Z","size":364,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-14T19:15:40.442Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cnfatal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-24T08:03:18.000Z","updated_at":"2026-01-14T15:39:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cnfatal/schema-ts","commit_stats":null,"previous_names":["cnfatal/schema-ts"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/cnfatal/schema-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnfatal%2Fschema-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnfatal%2Fschema-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnfatal%2Fschema-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnfatal%2Fschema-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnfatal","download_url":"https://codeload.github.com/cnfatal/schema-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnfatal%2Fschema-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-05T05:11:33.937Z","updated_at":"2026-01-16T11:58:57.348Z","avatar_url":"https://github.com/cnfatal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# schema-ts\n\nA high-performance Schema validation and UI generation framework based on TypeScript.\n\n[![Demo](https://img.shields.io/badge/Demo-Live-brightgreen)](https://cnfatal.github.io/schema-ts/)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n## Features\n\n- **Full-stack Type Safety**: Complete TypeScript type inference from Schema definition to UI forms.\n- **JSON Schema 2020-12 Standard**: Core validation engine strictly follows the latest JSON Schema spec, supporting complex logic.\n- **Backward Compatibility**: Supports backward compatibility with earlier JSON Schema drafts (Draft 4, 6, 7, 2019-09).\n- **Multi-framework Support**: One Schema, supports both React and Vue 3 for automatic form generation.\n- **Highly Extensible**: Supports custom validation rules, custom UI components (Widgets), and internationalization (i18n).\n- **Lightweight \u0026 Efficient**: Core library has zero external dependencies, suitable for both Node.js and browser environments.\n\n## 🔗 Online Experience\n\n[Click to visit Playground Demo](https://cnfatal.github.io/schema-ts/)\n\nIn the Playground, you can edit Schema in real-time and see the generated React form.\n\n## Usage Examples (@schema-ts/core)\n\n### Basic Validation\n\n```typescript\nimport { Validator } from \"@schema-ts/core\";\n\nconst validator = new Validator();\nconst schema = {\n  type: \"object\",\n  properties: {\n    username: { type: \"string\", minLength: 3 },\n    age: { type: \"number\", minimum: 18 },\n  },\n  required: [\"username\"],\n};\n\nconst result = validator.validate(schema, {\n  username: \"ts\",\n  age: 16,\n});\n\nif (!result.valid) {\n  console.log(result.errors.map((err) =\u003e validator.formatError(err)));\n  // Output: [\"must NOT have fewer than 3 characters\", \"must be greater than or equal to 18\"]\n}\n```\n\n### Complex Logic Validation (if/then/else)\n\n```typescript\nconst schema = {\n  type: \"object\",\n  properties: {\n    isMember: { type: \"boolean\" },\n    membershipNumber: { type: \"string\" },\n  },\n  if: {\n    properties: { isMember: { const: true } },\n  },\n  then: {\n    required: [\"membershipNumber\"],\n  },\n};\n\n// When isMember is true, membershipNumber becomes a required field.\n```\n\n## UI Generation\n\n### React (@schema-ts/react)\n\nThe React package provides a highly flexible `Form` component, supporting nested objects and arrays.\n\n```tsx\nimport { Form } from \"@schema-ts/react\";\n\nconst schema = {\n  type: \"object\",\n  properties: {\n    email: { type: \"string\", format: \"email\", title: \"Email\" },\n    password: { type: \"string\", title: \"Password\" },\n  },\n};\n\nfunction App() {\n  return (\n    \u003cForm\n      schema={schema}\n      onChange={(data) =\u003e console.log(\"Form Data:\", data)}\n    /\u003e\n  );\n}\n```\n\n### Vue 3 (@schema-ts/vue)\n\nThe Vue package provides an out-of-the-box `Form` component.\n\n```vue\n\u003ctemplate\u003e\n  \u003cForm :schema=\"schema\" @change=\"handleChange\" /\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\nimport { Form } from \"@schema-ts/vue\";\n\nconst schema = {\n  type: \"object\",\n  properties: {\n    username: { type: \"string\", minLength: 3, title: \"Username\" },\n    age: { type: \"number\", minimum: 18, title: \"Age\" },\n  },\n};\n\nconst handleChange = (data) =\u003e {\n  console.log(\"Form Data:\", data);\n};\n\u003c/script\u003e\n```\n\n## Project Structure\n\n- `packages/core`: Core validation engine, supporting JSON Schema 2020-12.\n- `packages/react`: React integration library, providing `Form` component and Hooks.\n- `packages/vue`: Vue 3 integration library, under construction.\n- `packages/playground`: Online demo system, built with Vite + React.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnfatal%2Fschema-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnfatal%2Fschema-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnfatal%2Fschema-ts/lists"}