fix: qualify external ref schema types in default response codes#2241
Merged
jamietanna merged 1 commit intooapi-codegen:mainfrom Feb 27, 2026
Merged
fix: qualify external ref schema types in default response codes#2241jamietanna merged 1 commit intooapi-codegen:mainfrom
jamietanna merged 1 commit intooapi-codegen:mainfrom
Conversation
Closes oapi-codegen#2113 When a response uses a $ref to an external components/responses definition, the generated strict-server code for non-fixed status codes (e.g. default) used the inner schema type without the external package qualifier, causing a compile error. Apply ensureExternalRefsInSchema to response content schemas after resolving external response refs. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Member
Author
Greptile SummaryThis PR fixes a compilation error that occurred when using external Key Changes:
Testing:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| pkg/codegen/operations.go | Adds external ref qualifier to response content schemas for non-fixed status codes, fixing compilation errors with external response refs |
| internal/test/issues/issue-2113/spec.yaml | Test spec demonstrating external ref in both fixed (400) and default response codes |
| internal/test/issues/issue-2113/issue_test.go | Compilation test verifying default response type uses qualified common.ProblemDetails instead of unqualified ProblemDetails |
Last reviewed commit: 71fc215
jamietanna
approved these changes
Feb 26, 2026
jamietanna
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2113
When a response uses a $ref to an external components/responses definition, the generated strict-server code for non-fixed status codes (e.g. default) used the inner schema type without the external package qualifier, causing a compile error. Apply
ensureExternalRefsInSchema to response content schemas after resolving external response refs.