[Kotlin][Spring] use WebFlux Part types for reactive multipart files#24296
Draft
wingwogus wants to merge 1 commit into
Draft
[Kotlin][Spring] use WebFlux Part types for reactive multipart files#24296wingwogus wants to merge 1 commit into
wingwogus wants to merge 1 commit into
Conversation
Kotlin Spring reactive server endpoints must accept WebFlux Part values, including Flux for file arrays, so generated controllers and service surfaces remain compatible with the reactive request pipeline. Derive the template condition inside the server generator and preserve the existing MVC and declarative-interface output. Constraint: WebFlux server generation requires Part and Flux<Part>; blocking and declarative HTTP interface output must retain MultipartFile. Rejected: Rewrite broader multipart templates | would churn unrelated model, form-field, and array rendering. Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep reactiveMultipart derived from reactive Spring Boot server mode; do not key this shared partial on reactive alone. Tested: Focused multipart tests; KotlinSpringServerCodegenTest 236/0/0/0; checkstyle; both sample main source sets compile; base/current generated-output differential. Not-tested: Official JDK 11 and Gradle 7.6.4 sample CI matrix; baseline-stale unrelated sample test-source errors remain.
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 #21548.
Summary
org.springframework.http.codec.multipart.Partfor reactive Kotlin Spring Boot servers.reactor.core.publisher.Flux<Part>.MultipartFile/Array<MultipartFile>output for blocking Spring Boot and reactive declarative HTTP interfaces.Implementation notes
A private derived template flag is enabled only for
reactive=truewith thespring-bootlibrary. The existingoptionalDataType.mustachefile branch uses that flag, so this remains a narrow type-system correction rather than a new public generator option or a broad template split.The two checked-in reactive Kotlin Spring samples were regenerated. Their intended deltas are limited to the multipart parameter type in the controller, service, service implementation, and generated API test.
@dr4ke616 @e5l, this touches the Kotlin Spring Boot reactive server output.
Verification
KotlinSpringServerCodegenTest: 236 tests, 0 failures/errors/skips.kotlin-spring-boot-reactiveandkotlin-spring-boot-reactive-without-flowsamples.checkstyle:checkpassed formodules/openapi-generator.git diff --checkpassed.The official JDK 11 / Gradle 7.6.4 sample matrix was not available locally; CI is expected to cover it.
PR checklist
Summary by cubic
Use WebFlux
Partfor reactive multipart parameters in Kotlin Spring Boot servers, with arrays asFlux<Part>, to match the reactive request pipeline. Blocking Spring Boot and declarative HTTP interfaces keepMultipartFile. Fixes #21548.Bug Fixes
org.springframework.http.codec.multipart.Partandreactor.core.publisher.Flux<Part>whenreactive=truewith thespring-bootlibrary.spring-declarative-http-interfaceoutputs.Migration
Part(andFlux<Part>for arrays) instead ofMultipartFile/Array<MultipartFile>.Written for commit 805becf. Summary will update on new commits.