{"id":40263285,"url":"https://github.com/doordash-oss/oapi-codegen-dd","last_synced_at":"2026-04-08T01:03:15.751Z","repository":{"id":332199496,"uuid":"1132974055","full_name":"doordash-oss/oapi-codegen-dd","owner":"doordash-oss","description":"Generate Go models from OpenAPI spec","archived":false,"fork":false,"pushed_at":"2026-04-01T13:47:35.000Z","size":19230,"stargazers_count":38,"open_issues_count":3,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-04-01T15:29:50.774Z","etag":null,"topics":["code-generator","oapi-codegen","openapi"],"latest_commit_sha":null,"homepage":"https://doordash-oss.github.io/oapi-codegen-dd/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doordash-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.txt","maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":"CONTRIBUTOR_LICENSE_AGREEMENT.txt"}},"created_at":"2026-01-12T17:51:32.000Z","updated_at":"2026-04-01T13:45:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/doordash-oss/oapi-codegen-dd","commit_stats":null,"previous_names":["doordash-oss/oapi-codegen-dd"],"tags_count":281,"template":false,"template_full_name":null,"purl":"pkg:github/doordash-oss/oapi-codegen-dd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doordash-oss%2Foapi-codegen-dd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doordash-oss%2Foapi-codegen-dd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doordash-oss%2Foapi-codegen-dd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doordash-oss%2Foapi-codegen-dd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doordash-oss","download_url":"https://codeload.github.com/doordash-oss/oapi-codegen-dd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doordash-oss%2Foapi-codegen-dd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31535206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["code-generator","oapi-codegen","openapi"],"created_at":"2026-01-20T02:33:42.040Z","updated_at":"2026-04-08T01:03:15.741Z","avatar_url":"https://github.com/doordash-oss.png","language":"Go","readme":"\u003c!-- --8\u003c-- [start:docs] --\u003e\n# `oapi-codegen`\n\n\u003e **Battle-tested**: This generator is continuously tested against 2,000+ real-world OpenAPI specs, successfully generating and compiling over 20 million lines of Go code. Handles complex specs with circular references, deep nesting, and union types.\n\nUsing `oapi-codegen` allows you to reduce the boilerplate required to create or integrate with\nservices based on [OpenAPI 3.x](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md), and instead focus on writing your business logic, and working\non the real value-add for your organization.\n\n## Features\n\n### Code Generation\n- **Idiomatic Go code** - Clean, readable generated code that follows Go conventions\n- **OpenAPI 3.x support** - Comprehensive support for OpenAPI 3.0 and 3.1 specifications\n- **Flexible output** - Single or multiple file output with configurable structure\n- **Smart pruning** - Automatically removes unused types by default (configurable)\n\n### Type System\n- **Union types** - Full support for `oneOf`, `anyOf`, and `allOf` with intelligent type merging and `runtime.Either[A, B]` for two-element unions\n- **Additional properties** - Handle dynamic fields with `map[string]interface{}` or custom types\n- **Validation** - Built-in validation using [go-playground/validator](https://github.com/go-playground/validator) with `Validate()` methods on generated types\n- **Custom extensions** - for fine-grained control over code generation\n\n### Client Generation\n- **HTTP client generation** - Generate type-safe HTTP clients with customizable timeout and request editors\n- **Custom client types** - Wrap generated clients with your own types for additional functionality\n- **Error mapping** - Map response types to implement the `error` interface automatically\n\n### Server Generation\n- **Complete server scaffolding** - Generate service interfaces, HTTP adapters, routers, and server main.go\n- **13 framework support** - Chi, Echo, Gin, Fiber, std-http, Beego, go-zero, Kratos, GoFrame, Hertz, gorilla-mux, fasthttp, Iris\n- **Clean architecture** - Service interface pattern separates business logic from HTTP handling\n- **Request/response validation** - Optional validation in generated handlers\n\n### MCP Server Generation\n- **[MCP (Model Context Protocol)](https://modelcontextprotocol.io/)** - Generate MCP servers for AI assistant integration\n- **Tool generation** - Each API operation becomes an MCP tool that AI assistants can call\n- **x-mcp extension** - Control tool names, descriptions, and skip operations\n- **Works with Claude Desktop, Cursor, and other MCP clients**\n\n### Configuration \u0026 Filtering\n- **YAML-based configuration** with JSON schema validation\n- **Flexible filtering** - Include/exclude by paths, tags, operation IDs, webhooks, schema properties, or extensions\n- **Transitive pruning** - Automatically remove schemas that are only referenced by filtered-out properties\n- **[OpenAPI Overlays](https://doordash-oss.github.io/oapi-codegen-dd/overlays/)** - Modify specs without editing originals (add extensions, remove paths)\n- **External file `$ref` resolution** - Split specs across multiple files with relative `$ref` references (auto-detected from spec path, or set `base-path` in config)\n\n### Programmatic Access\n- **Runtime package** - Public API for working with generated types\n- **TypeTracker** - Internal API for managing type definitions programmatically (for advanced use cases)\n\n## Quick Start\n```bash\n# Install\ngo install github.com/doordash-oss/oapi-codegen-dd/v3/cmd/oapi-codegen@latest\n\n# Generate code from the Petstore example\noapi-codegen https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml \u003e petstore.go\n```\n\n## Examples\nThe [examples directory](https://github.com/doordash-oss/oapi-codegen-dd/tree/main/examples) contains useful examples of how to use `oapi-codegen`.\n\n## Why v3?\n\nThis project is a fork of [oapi-codegen](https://github.com/oapi-codegen/oapi-codegen) v2, fully reworked to address limitations in the original.\n\n### Compatibility\n\nTested against [2,137 real-world OpenAPI 3.0 specs](https://github.com/mockzilla/specs):\n\n| Version | Passed | Failed | Pass Rate |\n|---------|--------|--------|-----------|\n| **v3** | 2,137 | 0 | **100%** |\n| v2 | 1,159 | 978 | 54.2% |\n\n### Key Improvements\n\n| Category | v2 | v3 |\n|----------|----|----|\n| **OpenAPI Support** | 3.0 only | 3.0, 3.1, 3.2 |\n| **Parser** | `kin-openapi` | `libopenapi` |\n| **Circular References** | Limited | Full support |\n| **Union Types (oneOf/anyOf)** | Basic | Full with optimizations |\n| **Name Conflicts** | Manual fix required | Automatic resolution |\n| **Validation** | None | `Validate()` methods |\n| **Server Scaffold** | Interface only, manual boilerplate | Full typed solution (service, middleware, main.go) |\n| **Webhooks** | Not supported | Full type generation with filtering |\n| **Filtering** | Tags, operation IDs | + Paths, webhooks, extensions, schema properties |\n| **Overlays** | Single | Multiple, applied in order |\n| **Output** | Single file | Single or multiple files |\n| **Templates** | Monolithic | Composable with `{{define}}` blocks |\n| **Programmatic API** | Limited | Full (`ParseContext`, `TypeTracker`) |\n| **Server Frameworks** | 7 (Chi, Echo, Fiber, Gin, Gorilla, Iris, std-http) | 13 (+ Beego, go-zero, Kratos, GoFrame, Hertz, fasthttp) |\n| **MCP Server** | None | Full (AI assistant integration) |\n\n### Migration\n\nIf you're migrating from v2, please refer to the [migration guide](https://doordash-oss.github.io/oapi-codegen-dd/migrate-from-v2/).\n\u003c!-- --8\u003c-- [end:docs] --\u003e\n\n## License\nThis project is licensed under the Apache License 2.0.  \nSee [LICENSE.txt](LICENSE.txt) for details.\n\n## Notices\nSee [NOTICE.txt](NOTICE.txt) for third-party components and attributions.\n\n## Contributor License Agreement (CLA)\nContributions to this project require agreeing to the DoorDash Contributor License Agreement.  \nSee [CONTRIBUTOR_LICENSE_AGREEMENT.txt](CONTRIBUTOR_LICENSE_AGREEMENT.txt).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoordash-oss%2Foapi-codegen-dd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoordash-oss%2Foapi-codegen-dd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoordash-oss%2Foapi-codegen-dd/lists"}