{"id":16587981,"url":"https://github.com/gcanti/io-ts-codegen","last_synced_at":"2025-04-05T02:08:06.123Z","repository":{"id":57109676,"uuid":"83990589","full_name":"gcanti/io-ts-codegen","owner":"gcanti","description":"Code generation for io-ts","archived":false,"fork":false,"pushed_at":"2023-02-24T14:31:06.000Z","size":490,"stargazers_count":156,"open_issues_count":8,"forks_count":14,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-12T22:55:29.630Z","etag":null,"topics":["code-generation","io-ts","typescript"],"latest_commit_sha":null,"homepage":"https://gcanti.github.io/io-ts-codegen/","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/gcanti.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2017-03-05T17:59:18.000Z","updated_at":"2024-09-30T11:38:18.000Z","dependencies_parsed_at":"2024-06-18T15:24:04.913Z","dependency_job_id":"68bc062f-f61f-4894-a10e-61bc879c95fe","html_url":"https://github.com/gcanti/io-ts-codegen","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Fio-ts-codegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Fio-ts-codegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Fio-ts-codegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Fio-ts-codegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gcanti","download_url":"https://codeload.github.com/gcanti/io-ts-codegen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276164,"owners_count":20912288,"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":["code-generation","io-ts","typescript"],"created_at":"2024-10-11T22:55:31.224Z","updated_at":"2025-04-05T02:08:06.101Z","avatar_url":"https://github.com/gcanti.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Motivation\n\nGenerate both static and runtime types from an intermediate language.\n\nThe intermediate language can in turn be generated from other schemas: JSON Schema, Swagger, [metarpheus](https://github.com/buildo/metarpheus), etc..\n\n# `io-ts` compatibility\n\n| `io-ts-codegen` version | target `io-ts` version |\n| ----------------------- | ---------------------- |\n| 0.4.0+                  | 1.0.0+ \\|\\| 2.0.0+     |\n| 0.3.0+                  | 1.0.0+ \\|\\| 2.0.0+     |\n\n# Usage\n\nNodes of the intermediate language can be built from the provided builders.\n\n```ts\nimport * as gen from 'io-ts-codegen'\n\n// list of type declarations\nconst declarations = [\n  gen.typeDeclaration('Persons', gen.arrayCombinator(gen.identifier('Person'))),\n  gen.typeDeclaration(\n    'Person',\n    gen.typeCombinator([gen.property('name', gen.stringType), gen.property('age', gen.numberType)])\n  )\n]\n\n// apply topological sort in order to get the right order\nconst sorted = gen.sort(declarations)\n\nconsole.log(sorted.map(d =\u003e gen.printRuntime(d)).join('\\n'))\nconsole.log(sorted.map(d =\u003e gen.printStatic(d)).join('\\n'))\n```\n\nOutput (as string)\n\n```ts\nconst Person = t.type({\n  name: t.string,\n  age: t.number\n})\nconst Persons = t.array(Person)\ninterface Person {\n  name: string\n  age: number\n}\ntype Persons = Array\u003ct.TypeOf\u003ctypeof Person\u003e\u003e\n```\n\n# Documentation\n\n- [API Reference](https://gcanti.github.io/io-ts-codegen)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcanti%2Fio-ts-codegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcanti%2Fio-ts-codegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcanti%2Fio-ts-codegen/lists"}