Commit e6027b5
fix: resolve OpenAPI spec $ref naming mismatch
DefaultOpenAPIV3Config pre-computes the Definitions map immediately
using the default GetDefinitionName (without ToRESTFriendlyName). The
kube-openapi builder (builder3/openapi.go) prefers the pre-computed
Definitions map over calling GetDefinitions again — so when main.go
overrides GetDefinitionName to add ToRESTFriendlyName, the schema
component keys get the friendly names but the $ref strings inside the
pre-computed map do not.
This caused the generated OpenAPI spec to have mismatched naming
conventions between $ref values and schema component keys, breaking
clients that rely on ref resolution (e.g. openapi-ts code generators).
Fix: nil out Definitions after overriding GetDefinitionName so the
builder falls through to GetDefinitions and builds fresh $refs using
the corrected GetDefinitionName, keeping both sides consistent.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent dd4a121 commit e6027b5
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
193 | 199 | | |
194 | 200 | | |
195 | 201 | | |
| |||
0 commit comments