{"id":14156651,"url":"https://github.com/astahmer/typed-openapi","last_synced_at":"2025-04-05T09:04:57.828Z","repository":{"id":186563583,"uuid":"674419252","full_name":"astahmer/typed-openapi","owner":"astahmer","description":"Generate a headless Typescript API client from an OpenAPI spec","archived":false,"fork":false,"pushed_at":"2024-02-07T17:34:11.000Z","size":571,"stargazers_count":142,"open_issues_count":10,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-02T01:13:25.314Z","etag":null,"topics":["arktype","generator","io-ts","openapi","runtime","typebox","typescript","valibot","yup","zod"],"latest_commit_sha":null,"homepage":"https://typed-openapi-web.vercel.app/","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/astahmer.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}},"created_at":"2023-08-03T22:57:13.000Z","updated_at":"2024-04-29T07:34:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d353991-65da-4a99-9bbe-5287575d6272","html_url":"https://github.com/astahmer/typed-openapi","commit_stats":null,"previous_names":["astahmer/typed-openapi"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astahmer%2Ftyped-openapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astahmer%2Ftyped-openapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astahmer%2Ftyped-openapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astahmer%2Ftyped-openapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astahmer","download_url":"https://codeload.github.com/astahmer/typed-openapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312077,"owners_count":20918344,"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":["arktype","generator","io-ts","openapi","runtime","typebox","typescript","valibot","yup","zod"],"created_at":"2024-08-17T08:07:32.163Z","updated_at":"2025-04-05T09:04:57.754Z","avatar_url":"https://github.com/astahmer.png","language":"TypeScript","funding_links":[],"categories":["typescript","TypeScript"],"sub_categories":[],"readme":"# typed-openapi\n\nGenerate a Typescript API client from an OpenAPI spec\n\nSee [the online playground](https://typed-openapi-astahmer.vercel.app/)\n\n![Screenshot 2023-08-08 at 00 48 42](https://github.com/astahmer/typed-openapi/assets/47224540/3016fa92-e09a-41f3-a95f-32caa41325da)\n\n## Features\n\n- Headless API client, bring your own fetcher ! (fetch, axios, ky, etc...)\n- Generates a fully typesafe API client with just types by default (instant suggestions)\n- Or you can also generate a client with runtime validation using one of the following runtimes:\n  - [zod](https://zod.dev/)\n  - [typebox](https://github.com/sinclairzx81/typebox)\n  - [arktype](https://arktype.io/)\n  - [valibot](https://valibot.dev/)\n  - [io-ts](https://gcanti.github.io/io-ts/)\n  - [yup](https://github.com/jquense/yup)\n\nThe generated client is a single file that can be used in the browser or in node. Runtime validation schemas are\nprovided by the excellent [typebox-codegen](https://github.com/sinclairzx81/typebox-codegen)\n\n## Install \u0026 usage\n\n```sh\npnpm add typed-openapi\n```\n\nIt exports a bunch of functions that can be used to build your own tooling on top of it. You can look at the\n[CLI code](packages/typed-openapi/src/cli.ts) so see how to use them.\n\n## CLI\n\n```sh\nnpx typed-openapi -h\n```\n\n```sh\ntyped-openapi/0.1.3\n\nUsage: $ typed-openapi \u003cinput\u003e\n\nCommands: \u003cinput\u003e Generate\n\nFor more info, run any command with the `--help` flag: $ typed-openapi --help\n\nOptions: -o, --output \u003cpath\u003e Output path for the api client ts file (defaults to `\u003cinput\u003e.\u003cruntime\u003e.ts`) -r, --runtime\n\u003cname\u003e Runtime to use for validation; defaults to `none`; available: 'none' | 'arktype' | 'io-ts' | 'typebox' |\n'valibot' | 'yup' | 'zod' (default: none) -h, --help Display this message -v, --version Display version number\n```\n\n## Non-goals\n\n- Caring too much about the runtime validation code. If that works (thanks to\n  [typebox-codegen](https://github.com/sinclairzx81/typebox-codegen)), that's great, otherwise I'm not really interested\n  in fixing it. If you are, feel free to open a PR.\n\n- Supporting all the OpenAPI spec. Regex, dates, files, whatever, that's not the point here.\n  [openapi-zod-client](https://github.com/astahmer/openapi-zod-client) does a great job at that, but it's slow to\n  generate the client and the suggestions in the IDE are not instant. I'm only interested in supporting the subset of\n  the spec that makes the API client typesafe and fast to provide suggetions in the IDE.\n\n- Splitting the generated client into multiple files. Nope. Been there, done that. Let's keep it simple.\n\nBasically, let's focus on having a fast and typesafe API client generation instead.\n\n## Alternatives\n\n[openapi-zod-client](https://github.com/astahmer/openapi-zod-client), which generates a\n[zodios](https://github.com/ecyrbe/zodios) client but can be slow to provide IDE suggestions when the OpenAPI spec is\nlarge. Also, you might not always want to use zod or even runtime validation, hence this project.\n\n## Contributing\n\n- `pnpm i`\n- `pnpm build`\n- `pnpm test`\n\nWhen you're done with your changes, please run `pnpm changeset` in the root of the repo and follow the instructions\ndescribed [here](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastahmer%2Ftyped-openapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastahmer%2Ftyped-openapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastahmer%2Ftyped-openapi/lists"}