fix: enable strict mode for swagger generation & upgrade swag by mtojek · Pull Request #21975 · coder/coder

added 2 commits

February 6, 2026 09:39
The upstream swag CLI (v1.16.2) does not expose a --strict flag, so
warnings about duplicate routes are silently ignored (exit code 0).
With Strict mode, duplicate @router declarations become hard errors
instead of silent overwrites.

This adds a Go wrapper (scripts/apidocgen/swaginit/main.go) that
calls the swag gen.Build() API directly with Strict: true, and
updates generate.sh to use it instead of 'go tool swag init'.
Notable improvements:
- Better generics support (map params, function-scoped types)
- More precise numeric format annotations (float64, int64)
- x-enum-descriptions for richer API docs
- json:omitempty marks fields as optional
- Security fix for CVE-2024-45338 (x/net)
- Swagger output now uses spaces instead of tabs

@mtojek

@mtojek mtojek changed the title fix(apidocgen): enable strict mode for swagger generation & upgrade swag fix: enable strict mode for swagger generation & upgrade swag

Feb 6, 2026

@mtojek mtojek marked this pull request as ready for review

February 6, 2026 10:44

johnstcn

@mtojek mtojek deleted the fix/apidocgen-strict-mode branch

February 6, 2026 12:04