oapi-codegen is an OpenAPI specification compiler and code generator for Go. It transforms OpenAPI definitions into type-safe Go client libraries, server boilerplate, and data models to facilitate contract-first API development.
The tool distinguishes itself through a flexible customization system that allows users to override generated types and imports via specification extensions. It supports the use of custom text templates to redefine the final source code structure and provides a specification overlay mechanism to modify or remove endpoints without altering the original source file.
The generator covers a broad range of capabilities including the synthesis of strict server interfaces for request handling, the creation of production-ready HTTP clients, and the mapping of server URLs. It also produces middleware for API request validation and provides specialized handling for nullable types to distinguish between omitted and null values.