fix(spring): split response content types#24202
Open
maiph wants to merge 1 commit into
Open
Conversation
Add an opt-in splitResponseTypes option for the spring generator so operations with multiple response content types can generate separate methods without changing the default output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 #8701
Summary
splitResponseTypesoption to the spring generatorWhy
Spring cannot disambiguate multiple API operations on the same path and method when they differ only by response
Accept/producesvalues unless separate methods are generated. The previous attempt in #12462 pushed this behavior into core; this change keeps it Spring-local and opt-in.Testing
./mvnw -q -pl modules/openapi-generator -am -DskipITs -Dsurefire.failIfNoSpecifiedTests=false -Dtest=SpringCodegenTest test./mvnw -q -pl modules/openapi-generator -am -DskipITs -Dsurefire.failIfNoSpecifiedTests=false -Dtest=SpringCodegenTest,AbstractJavaCodegenTest,DefaultCodegenTest test./bin/utils/export_generator.sh springSummary by cubic
Adds an opt-in
splitResponseTypesoption to the Spring generator to emit one method per response media type when an operation returns multiple content types. The default output stays the same and avoids Spring mapping conflicts when operations differ only byproduces/Accept.New Features
splitResponseTypes(defaultfalse) to generate one method per response content type.producesand return type (e.g.,application/octet-streamreturns a resource/binary type).Migration
-p splitResponseTypes=true(CLI) orsplitResponseTypes: truein config.Written for commit c440eb5. Summary will update on new commits.