{"id":37035897,"url":"https://github.com/magnusopera/openapigen","last_synced_at":"2026-01-14T04:15:26.521Z","repository":{"id":308686392,"uuid":"1033659538","full_name":"MagnusOpera/OpenApiGen","owner":"MagnusOpera","description":"TypeScript OpenApi Generator","archived":false,"fork":false,"pushed_at":"2025-11-22T21:32:14.000Z","size":106,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-22T23:20:57.651Z","etag":null,"topics":["dotnet","openapi","tool","typescript"],"latest_commit_sha":null,"homepage":"","language":"C#","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/MagnusOpera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-08-07T06:45:33.000Z","updated_at":"2025-11-22T21:32:02.000Z","dependencies_parsed_at":"2025-10-18T14:22:39.873Z","dependency_job_id":"f8381fa4-947d-4b9d-8ec8-4fa807cd0117","html_url":"https://github.com/MagnusOpera/OpenApiGen","commit_stats":null,"previous_names":["magnusopera/openapigen"],"tags_count":51,"template":false,"template_full_name":null,"purl":"pkg:github/MagnusOpera/OpenApiGen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FOpenApiGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FOpenApiGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FOpenApiGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FOpenApiGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MagnusOpera","download_url":"https://codeload.github.com/MagnusOpera/OpenApiGen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MagnusOpera%2FOpenApiGen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28409255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"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":["dotnet","openapi","tool","typescript"],"created_at":"2026-01-14T04:15:25.993Z","updated_at":"2026-01-14T04:15:26.516Z","avatar_url":"https://github.com/MagnusOpera.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenApiGen\n\nOpenApiGen is a .NET tool for generating OpenAPI-based TypeScript clients. It aims to produce simple, type-safe, and easily consumable clients for modern TypeScript applications, especially those using React Query and Axios.\n\n[![Build Status](https://github.com/MagnusOpera/OpenApiGen/actions/workflows/build.yml/badge.svg)](https://github.com/MagnusOpera/OpenApiGen/actions)\n\n[![NuGet Version](https://img.shields.io/nuget/v/MagnusOpera.OpenApiGen.svg)](https://www.nuget.org/packages/MagnusOpera.OpenApiGen)\n\n## Why OpenApiGen?\n\nExisting tools often generate overly complicated clients. OpenApiGen focuses on:\n\n- **Obvious input/output messages:** 1 input message + query args, 1 output message. Everything inlined unless specified.\n- **Simple functions for each operation:** Easy integration with React Query, no complicated classes or inheritance trees.\n\n\n### Example Generated Output\n\nBelow is a sample of the TypeScript client code generated by OpenApiGen for a PATCH operation on `/User/{id}`. This output demonstrates the inlined request/response types and the simple function signature designed for easy integration with tools like React Query:\n\n```typescript\n// === patch /User/{id} ===\nexport type UserIdPatchRequest = {\n    firstName: null | string\n    lastName: null | string\n}\nexport type UserIdPatch200Response = {\n    firstName: string\n    lastName: string\n}\nexport type UserIdPatch400Response = ProblemDetails\nexport type UserIdPatch404Response = ProblemDetails\nexport async function patchUserIdAsync(axios: AxiosInstance, bearer: string, id: string, request: UserIdPatchRequest): Promise\u003c[200, UserIdPatch200Response] | [400, UserIdPatch400Response] | [404, UserIdPatch404Response]\u003e {\n    const resp = await axios.patch(`/User/${id}`, request, { validateStatus: () =\u003e true, headers: { Authorization: `Bearer ${bearer}` } })\n    switch (resp.status) {\n        case 200: return [200, resp.data as UserIdPatch200Response]\n        case 400: return [400, resp.data as UserIdPatch400Response]\n        case 404: return [404, resp.data as UserIdPatch404Response]\n        default: throw `Unexpected status ${resp.status}`\n    }\n}\n```\n\n## Features\n\n- Generates TypeScript clients from OpenAPI definitions\n- Designed for easy integration with React Query\n- Inlines types for clarity and simplicity\n- Support for Bearer token (authorization header) and ApiKey (cookie)\n- Minimal dependencies, no runtime bloat\n- Supports OpenApi 3.0/3.1 Schema\n\n## Getting Started\n\n### Install via .NET Tool\n\nYou can install the latest released binary globally using the .NET CLI:\n\n```bash\ndotnet tool install --global MagnusOpera.OpenApiGen\n```\n\nOr update to the latest version:\n\n```bash\ndotnet tool update --global MagnusOpera.OpenApiGen\n```\n\nAfter installation, you can run the tool using:\n\n```bash\nopenapigen --help\n```\n\n### Prerequisites\n\n- [.NET 10.0 SDK](https://dotnet.microsoft.com/download)\n- Node.js (for consuming generated TypeScript clients)\n- [GNU Make](https://www.gnu.org/software/make/) (optional, for building with `make`)\n\n### Build\n\nClone the repository and build the tool:\n\n```bash\ngit clone https://github.com/MagnusOpera/OpenApiGen.git\ncd OpenApiGen\nmake build\n```\n\n\n### Test\nInstall Node.js dependencies (for checking TypeScript output):\n\n```bash\nmake install\n```\n\nTo run the generator with the provided sample project:\n\n```bash\nmake run\n```\n\nThis will generate a TypeScript client from the sample API definition in `SampleApi/SampleApi.json`. Output is available in the `generated` folder.\n\n### Usage\n\nRun the generator with your OpenAPI definition:\n\n```bash\ndotnet run --project OpenApiGen/OpenApiGen.csproj -- \u003cpath-to-openapi.json\u003e \u003coutput-dir\u003e\n```\n\nWith:\n- \u003cpath-to-openapi.json\u003e: path to openapi definition file\n- \u003coutput-dir\u003e: path to generated client. WARNING: content is purged without notice.\n\n#### Example\n\n```bash\ndotnet run --project OpenApiGen/OpenApiGen.csproj -- Examples/config.json Examples/api.json -o ./generated\n```\n\n## Project Structure\n\n- `OpenApiGen/` - Main C# generator code\n- `Examples/` - Example OpenAPI definitions and configuration files\n\n## Contributing\n\nContributions are welcome! Please open issues or pull requests for bug fixes, features, or documentation improvements.\n\n## License\n\nThis project is licensed under the MIT License. See [LICENSE.md](../LICENSE.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnusopera%2Fopenapigen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagnusopera%2Fopenapigen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagnusopera%2Fopenapigen/lists"}