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
This is all related, and very similar to #2288. Externalrefs were added after the code was written, and the traversal doesn't extend to all the same schema properties. The fix for #2288 will fix this too.
@cdevienne . #/components/pathitems is an OpenAPI 3.1 property. We are using kin-openapi which doesn't support OpenAPI 3.1. Until we figure out how to support 3.1, we can't actually traverse into that.
I'm going to work a little bit on my experimental 3.1 implementation to see if it works there.
It looks like kin-openapi inlines this $ref and I don't know it's a ref. This means this would likely work within a single specification, because the pathitems would be invisibly inlined into the operations, but I can't get it working with externalRefs
I've investigated this by having Claude generate and test a spec against the feat/kin-openapi-3.1 branch, and I can confirm that the bug will still be present once we merge in 3.1 support, but there will be enough information in the spec to fix it. This is the root cause:
responseRef.Ref = "#/components/responses/VersionGetResponse" — looks local, even though it's reached via an externally-ref'd path item.
The codegen plumbing for path-item refs is partially in place: OperationDefinition.PathItemRef is set, externalPackageFor() resolves it to the import-mapped package, and ensureExternalRefsInResponseDefinitions(&defs, pathItem.Ref) qualifies the content schema of each response.
But the strict-server envelope wraps a name derived from ResponseDefinition.Ref, set in pkg/codegen/operations.go around GenerateResponseDefinitions:
pathItemRef isn't consulted here, so RefPathToGoType treats the response ref as local. ResponseDefinition.IsExternalRef() then returns false (it just checks for a . in Ref), and strict-interface.tmpl falls into the local-ref arm:
type {{$receiverTypeName}} struct{ {{$ref}}{{.NameTagOrContentType}}Response }
producing the unqualified VersionGetResponseJSONResponse.
Activity
mromaszewicz commentedon Mar 27, 2026
This is all related, and very similar to #2288. Externalrefs were added after the code was written, and the traversal doesn't extend to all the same schema properties. The fix for #2288 will fix this too.
mromaszewicz commentedon Mar 27, 2026
Oh, wait, this is different.
@cdevienne .
#/components/pathitemsis an OpenAPI 3.1 property. We are using kin-openapi which doesn't support OpenAPI 3.1. Until we figure out how to support 3.1, we can't actually traverse into that.I'm going to work a little bit on my experimental 3.1 implementation to see if it works there.
It looks like kin-openapi inlines this $ref and I don't know it's a ref. This means this would likely work within a single specification, because the pathitems would be invisibly inlined into the operations, but I can't get it working with externalRefs
cdevienne commentedon Mar 30, 2026
Candid question: isn't the 'Origin' field in the Schema type of kin-openapi supposed to tell where the data type is actually defined?
[-]External reference not properly prefixed in generated response types[/-][+]PathItem support missing[/+]mromaszewicz commentedon May 1, 2026
I've investigated this by having Claude generate and test a spec against the feat/kin-openapi-3.1 branch, and I can confirm that the bug will still be present once we merge in 3.1 support, but there will be enough information in the spec to fix it. This is the root cause:
After kin-openapi resolves the spec:
pathItem.Ref = "./types.yaml#/components/pathItems/VersionOperations"(preserved ✓)responseRef.Ref = "#/components/responses/VersionGetResponse"— looks local, even though it's reached via an externally-ref'd path item.The codegen plumbing for path-item refs is partially in place:
OperationDefinition.PathItemRefis set,externalPackageFor()resolves it to the import-mapped package, andensureExternalRefsInResponseDefinitions(&defs, pathItem.Ref)qualifies the content schema of each response.But the strict-server envelope wraps a name derived from
ResponseDefinition.Ref, set inpkg/codegen/operations.goaroundGenerateResponseDefinitions:pathItemRefisn't consulted here, soRefPathToGoTypetreats the response ref as local.ResponseDefinition.IsExternalRef()then returns false (it just checks for a.inRef), andstrict-interface.tmplfalls into the local-ref arm:type {{$receiverTypeName}} struct{ {{$ref}}{{.NameTagOrContentType}}Response }producing the unqualified
VersionGetResponseJSONResponse.fix: qualify response refs from externally-ref'd path items
fix: qualify response refs from externally-ref'd path items
fix: qualify response refs from externally-ref'd path items
fix: qualify response refs from externally-ref'd path items (#2421)
fix: honour external package's Go name for direct response refs (#2423)
fix: qualify response refs from externally-ref'd path items (oapi-cod…
fix: honour external package's Go name for direct response refs (oapi…