How kolah/eugene works
Eugene is a CLI that turns OpenAPI 3.0–3.2 specifications into configurable Go API artifacts. The main workflow loads and transforms a spec into an internal model, then generates selected targets and writes the formatted files. Targets cover schemas, HTTP clients, framework-specific servers, typed strict servers, and embedded specs; documented features include streaming, custom templates, and OpenAPI extensions. The sampled code confirms the CLI, transformation, generation, and template execution flow; several target details are documented but not fully sampled.
Main entry points: generator.go Generation pipeline · engine.go Template engine · go.go Generate command · main.go CLI entry
Components 19
CLI and configuration
- CLI entry
cmd/eugene/main.go - Generate command
internal/cli/go.go - Configuration
internal/config/config.go
Spec processing
- OpenAPI loader
internal/loader/loader.go - Spec transformer
internal/loader/transform.go - API model
internal/model
Generation core
- Generation pipeline
internal/codegen/generator.go - Go utilities
internal/golang
Go output targets
- Type definitions
internal/targets/types/types.go - HTTP client
internal/targets/client/client.go - Server adapters
internal/targets/server - Strict server
internal/targets/strictserver/strictserver.go - Embedded spec
internal/targets/spec/spec.go
Templates and Go logic
- Template engine
internal/templates/engine.go - Built-in templates
templates/go
Other components
- CLI user
- OpenAPI file
- Generated files
- Custom templates
Connections 25
- CLI user → CLI entry: runs
- CLI entry → Generate command: executes
- Generate command → Configuration: loads config
- CLI user → OpenAPI file: provides
- Generate command → OpenAPI loader: loads spec
- OpenAPI loader → OpenAPI file: reads
- Generate command → Spec transformer: transforms result
- Spec transformer → API model: builds
- Generate command → Generation pipeline: generates from
- Generation pipeline → API model: reads
- Generation pipeline → Go utilities: uses
- Generation pipeline → Template engine: executes templates
- Template engine → Built-in templates: loads
- Template engine → Custom templates: loads overrides
- Generation pipeline → Type definitions: dispatches
- Generation pipeline → HTTP client: dispatches
- Generation pipeline → Server adapters: dispatches
- Generation pipeline → Strict server: dispatches
- Generation pipeline → Embedded spec: dispatches
- Type definitions → Template engine: renders
- HTTP client → Template engine: renders
- Server adapters → Template engine: renders
- Strict server → Template engine: renders
- Embedded spec → Template engine: renders
- Generate command → Generated files: writes