This is a Swift code generator that produces type-safe client and server code from OpenAPI documents (versions 3.0, 3.1, and preliminary 3.2). It is distributed as a Swift Package Manager build plugin, a command plugin, and a standalone CLI tool (`swift-openapi-generator`). The core architecture follows a pipeline: parse the OpenAPI document using YamsParser, translate the parsed representation into a structured Swift intermediate representation (IR) via a multiplex translator, and render the IR into Swift source files using a text-based renderer. The generated code is decoupled from specific HTTP transport libraries via `ClientTransport` and `ServerTransport` protocols, and supports middleware for cross-cutting concerns like logging, authentication, retrying, metrics, and tracing. The repository includes extensive examples covering a wide range of use cases: basic clients and servers, event streaming, multipart content, database integrations, and middleware stacks. The test suite is comprehensive, including unit tests, golden-file reference tests, and integration tests that compile and run generated code against mock transports. The project is actively maintained with a proposal process (SOAR) for feature additions and has a well-documented ecosystem of separate runtime and transport libraries.
oapi-codegen is a production-grade OpenAPI 3.0/3.1 code generator for Go that produces idiomatic server stubs, typed HTTP clients, and data models. It supports multiple Go web frameworks (Chi, Echo, Fiber v2/v3, Gin, Gorilla, Iris, and stdlib net/http) and generates both plain and strict server interfaces with middleware composition, request validation, and error handling. The generator is configurable via YAML files and offers features like import mapping for multi-package specs, OpenAPI overlay support, webhook generation, streaming responses, custom struct tags, and configurable schema-merging behaviors (v1/v2/v3) for allOf/anyOf/oneOf composition. The architecture is a library with a CLI wrapper (`cmd/oapi-codegen`). The core generation pipeline loads and validates an OpenAPI spec, gathers schemas from components/operations, resolves naming collisions, merges composed schemas, prunes unused components, and renders Go source files via user-overridable text/template files. The codebase is extensively tested with hundreds of generated regression tests covering edge cases in schema composition, parameter serialization, content types, and framework-specific behavior. The generator also embeds the original spec as a compressed base64 blob in generated packages for runtime access. Key reusable components include a robust naming resolution algorithm with collision handling, a configurable struct tag generation system with eager validation, a dead-code elimination module for pruning unused schema components, and standalone security providers (Bearer token, API key, Basic auth) for generated clients. The project maintains compatibility layers for schema-merging behavior versions and deprecated APIs, ensuring smooth upgrades while preserving existing generated code.
OpenAPI Generator CLI is a Node.js/TypeScript command-line wrapper around the Java-based OpenAPITools/openapi-generator JAR. Despite using NestJS, it is not a server: NestJS provides a DI application context that wires a Commander CLI. On every invocation (main.ts → AppModule.onApplicationBootstrap), it reads openapitools.json, resolves a generator version (querying Sonatype's Solr search for the latest stable when unset), writes it back to config, downloads and caches the JAR — atomically, via temp file + rename — then asks the Java CLI itself (via `help` and `completion` output) what commands it exposes, registers them dynamically, and spawns `java -jar ... <command>` with inherited stdio. It supports HTTP(S) proxies, JAVA_OPTS, custom generator JARs (classpath merge), and a Docker execution mode. Beyond pass-through, the CLI adds value the raw Java tool lacks: a `version-manager` subcommand (list/set/remove tagged versions backed by an interactive table picker) and a config-driven batch generator in openapitools.json where named generators map glob patterns to invocations with placeholder tokens (#{name}, #{cwd}, #{relPath}, #{ext}, ...), executed concurrently (max 10 processes). The repo is an Nx single-app monorepo bundled into a shebang'd main.js and released via semantic-release; GitHub Actions CI runs lint, unit tests, and real Java-based E2E on Ubuntu and macOS. Unit test coverage is thorough across config, version management, command pass-through, and command construction. Genuinely clever parts: dynamic discovery of an external CLI's command surface, atomic binary caching, and a table-to-interactive-select UI. The warts: a ~100-entry hardcoded fallback version list embedded in source, a legacy root lib/index.js publishing script superseded by the webpack package plugin, leftover NestJS scaffolding (environment stubs, 'not a production server' comment), deprecated RxJS toPromise() usage, an ESLint root config that effectively ignores all files, and a Nix flake pinned to Node 18 while the package requires Node 22. It does what it claims and is actively maintained, but the residue keeps it from being exemplary.