You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Evaluate and plan migration from oapi-codegen to another OpenAPI code generator. This is a prerequisite for migrating the OpenAPI spec to 3.1+ (#87), since oapi-codegen has no path to 3.1 support.
Due to the stall in oapi-codegen's OpenAPI 3.1 development, the current top contenders are ogen and openapi-generator.
Background: oapi-codegen Is Blocked on OpenAPI 3.1
As of March 2026, oapi-codegen cannot support OpenAPI 3.1 and there is no clear timeline:
oapi-codegen issue #373 (open since 2021): OpenAPI 3.1 not supported.
OpenAPI 3.1 parsing: Can parse 3.1 documents (with caveats — see limitations)
Type-safe responses: Each operation returns specific response types, providing compile-time checking
Built-in OpenTelemetry: Tracing and metrics out of the box
Code-generated static router: Better performance than runtime routing
No reflection JSON encoding: Uses go-faster/jx for better performance
Operation grouping: x-ogen-operation-group vendor extension for logical handler interfaces
Active development: 2,025 stars, regular releases (latest v1.20.1, Feb 2025), 4,826 commits
Known Limitations and Risks
Critical for TMI
No Gin integration — ogen generates a standalone http.Handler using stdlib net/http. TMI's entire Gin middleware stack (JWT auth, CORS, resource authorization, request tracing) would need to be rewritten as net/http middleware.
No WebSocket support — ogen is purely REST/HTTP. TMI's WebSocket collaborative editing must be handled outside ogen, mounted separately on the HTTP mux.
JSON Patch not supported (ogen issue #1587, closed without fix) — ogen skips operations with application/json-patch+json content type. TMI uses JSON Patch for partial updates. Requires workaround.
Required field validation not generated (ogen issue #1407, open 6+ months) — significant correctness/security gap.
Nested sum types generate non-compilable code (ogen issue #1480, open) — TMI's diagram cell types have nested unions.
Discriminator with duplicate mappings (ogen issue #980) — TMI has multiple node shapes mapping to the same Go type, which is already a pain point with oapi-codegen.
OpenAPI 3.1 Gaps
Type array syntax not supported (ogen issue #1617, open) — type: ["string", "null"] fails to parse. Workaround: use oneOf with type: "null" instead.
All-or-nothing generator — unlike oapi-codegen (which lets you bring your own router via Gin/Echo/Chi adapters), ogen generates the router, handler interface, request/response encoding, and validation as a monolith.
Optional fields use wrapper types (OptString, NilString, OptNilString) instead of pointers — changes how every optional field is handled.
Custom JSON marshaling may need adjustment due to go-faster/jx instead of encoding/json.
Summary
Evaluate and plan migration from oapi-codegen to another OpenAPI code generator. This is a prerequisite for migrating the OpenAPI spec to 3.1+ (#87), since oapi-codegen has no path to 3.1 support.
Due to the stall in oapi-codegen's OpenAPI 3.1 development, the current top contenders are ogen and openapi-generator.
Background: oapi-codegen Is Blocked on OpenAPI 3.1
As of March 2026, oapi-codegen cannot support OpenAPI 3.1 and there is no clear timeline:
runtime v1.2.0,gin-middleware v1.0.2,kin-openapi v0.134.0) are already at latest versions.Candidate 1: ogen
ogen is a Go-native OpenAPI code generator.
Strengths
go-faster/jxfor better performancex-ogen-operation-groupvendor extension for logical handler interfacesKnown Limitations and Risks
Critical for TMI
http.Handlerusing stdlibnet/http. TMI's entire Gin middleware stack (JWT auth, CORS, resource authorization, request tracing) would need to be rewritten asnet/httpmiddleware.application/json-patch+jsoncontent type. TMI uses JSON Patch for partial updates. Requires workaround.OpenAPI 3.1 Gaps
type: ["string", "null"]fails to parse. Workaround: useoneOfwithtype: "null"instead.unevaluatedProperties— no evidence of support. This is the main 3.1 feature TMI needs (deps: migrate to OpenAPI 3.1+ and use unevaluatedProperties for strict validation #87).Architectural Impact
OptString,NilString,OptNilString) instead of pointers — changes how every optional field is handled.go-faster/jxinstead ofencoding/json.Project Health
Candidate 2: openapi-generator
openapi-generator is the OpenAPI Initiative's official code generator, supporting 40+ languages including Go.
Strengths
go-server,go-gin-server,go-echo-serverKnown Limitations and Risks
Needs Investigation
Migration Effort Estimate
Regardless of which tool is selected, this would be a high-effort migration affecting most of the API layer:
Other Options
Tasks
Blocks
References