{"id":26891199,"url":"https://github.com/loom-agents/schema","last_synced_at":"2025-10-13T02:24:31.672Z","repository":{"id":285301065,"uuid":"957653445","full_name":"loom-agents/schema","owner":"loom-agents","description":"JSON Schemas, now.","archived":false,"fork":false,"pushed_at":"2025-03-30T22:13:48.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-30T23:20:28.637Z","etag":null,"topics":["ajv","json-schema","openai-api","runtime-validation","schema-validation","type","type-inference","type-safe","typescript"],"latest_commit_sha":null,"homepage":"https://loom-agents.github.io/docs/schema/","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/loom-agents.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":"2025-03-30T21:50:53.000Z","updated_at":"2025-03-30T22:13:51.000Z","dependencies_parsed_at":"2025-03-30T23:32:24.790Z","dependency_job_id":null,"html_url":"https://github.com/loom-agents/schema","commit_stats":null,"previous_names":["loom-agents/schema"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loom-agents%2Fschema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loom-agents%2Fschema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loom-agents%2Fschema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loom-agents%2Fschema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loom-agents","download_url":"https://codeload.github.com/loom-agents/schema/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246553041,"owners_count":20795835,"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":["ajv","json-schema","openai-api","runtime-validation","schema-validation","type","type-inference","type-safe","typescript"],"created_at":"2025-03-31T22:33:19.615Z","updated_at":"2025-10-13T02:24:31.652Z","avatar_url":"https://github.com/loom-agents.png","language":"TypeScript","readme":"# LOOM Schema\n\n**A schema system that does exactly what you need.**  \nType inference. Runtime validation. JSON Schema generation.  \nZero build steps. No extra fluff. It just works.\n\n[Read the docs](https://loom-agents.github.io/docs/schema/)\n\n---\n\nLOOM Schema was built because nothing else got this balance right:\n\n- ✅ Type-safe and composable\n- ✅ Validates at runtime\n- ✅ Emits spec-compliant JSON Schema\n- ❌ No codegen\n- ❌ No decorators\n- ❌ No build step\n\nYou write schema-like TypeScript. You get real JSON Schema and real validation. That’s the whole point.\n\n---\n\n## Install\n\n```sh\nbun add loom-schema\n```\n\nEverything’s bundled — including `ajv` and `ajv-formats`. No extra dependencies.\n\n---\n\n## Example\n\n```ts\nimport { object, string, number, Infer } from \"loom-schema\";\n\nconst User = object({\n  name: string({ minLength: 1 }),\n  age: number({ minimum: 0 }),\n});\n\ntype UserType = Infer\u003ctypeof User\u003e;\n\nconst result = await User.validate({ name: \"Ada\", age: 32 });\n\nif (!result.valid) {\n  console.error(result.errors);\n}\n```\n\n---\n\n## Use Cases\n\nUse LOOM Schema when you need to feed schemas into systems that **expect schemas**:\n\n- OpenAI Function calling\n- MCP \u0026 function serialization\n- API endpoints with runtime enforcement\n- Config validation and generation\n- Frontend forms based on types\n- CLI arg structure and validation\n\nIf it wants a schema, LOOM can give it one — safely, programmatically, and without ceremony.\n\n---\n\n## Features\n\n- 📐 **TypeScript-first**: deeply inferred types\n- 🧩 **Composable fragments**: mix and reuse schema pieces with ease\n- 🎛 **All the basics**: `allOf`, `anyOf`, `oneOf`, conditionals, etc.\n- 📄 **Standards-based**: JSON Schema 2020-12 compliance\n- 🧪 **Runtime validation**: powered by AJV with formats out of the box\n- 📦 **No config, no build step, no codegen**\n\n---\n\n## Schema Inference\n\n```ts\nconst Config = object({\n  apiKey: string(),\n  retries: number({ default: 3 }),\n});\n\ntype ConfigType = Infer\u003ctypeof Config\u003e;\n// {\n//   apiKey: string;\n//   retries: number;\n// }\n```\n\n---\n\n## Composition\n\n```ts\nimport { allOf, object, string } from \"loom-schema\";\n\nconst WithId = object({ id: string({ format: \"uuid\" }) });\n\nconst Product = allOf([\n  WithId,\n  object({\n    name: string(),\n    description: string(),\n  }),\n]);\n```\n\n---\n\n## Validation\n\n```ts\nconst result = await Product.validate({\n  id: \"123e4567-e89b-12d3-a456-426614174000\",\n  name: \"Widget\",\n  description: \"An example widget\",\n});\n```\n\nReturns `{ valid, errors }` from AJV — clean and informative.\n\n---\n\n## Philosophy\n\nLOOM Schema wasn’t built to be trendy. It was built to be **minimal**, **practical**, and **actually usable** across systems that expect real JSON Schema. It gives you the right pieces to build and validate data shapes at runtime — without taking over your project.\n\n---\n\n**You write types.**  \n**You get schemas.**  \n**That’s it.**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floom-agents%2Fschema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floom-agents%2Fschema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floom-agents%2Fschema/lists"}