Add missing case to type generation traversal#2298
Open
mromaszewicz wants to merge 1 commit intooapi-codegen:mainfrom
Open
Add missing case to type generation traversal#2298mromaszewicz wants to merge 1 commit intooapi-codegen:mainfrom
mromaszewicz wants to merge 1 commit intooapi-codegen:mainfrom
Conversation
4319a9b to
ff7a6f3
Compare
Fixes: oapi-codegen#1306 GenerateTypeDefsForOperation() was extracting AdditionalTypes from params and request bodies, but not from response content schemas. This meant that x-go-type-name on an inline response schema was silently ignored — the type definition was created internally but never collected for output. Add the missing loop over op.Responses[].Contents[].Schema to extract AdditionalTypes, matching the existing pattern for params and bodies. Extend the xgotypename example with a response-level x-go-type-name test case. Due to this bug, we've neglected to generate types for any types defined inline in responses, so a lot of generated files were affected due to those types being missing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ff7a6f3 to
62bc09c
Compare
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.
Fixes: #1306
GenerateTypeDefsForOperation() was extracting AdditionalTypes from params and request bodies, but not from response content schemas. This meant that x-go-type-name on an inline response schema was silently ignored — the type definition was created internally but never collected for output.
Add the missing loop over op.Responses[].Contents[].Schema to extract AdditionalTypes, matching the existing pattern for params and bodies. Extend the xgotypename example with a response-level x-go-type-name test case.
Due to this bug, we've neglected to generate types for any types defined inline in responses, so a lot of generated files were affected due to those types being missing.