-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[kotlin-spring] fix #9902 use coroutine Flow for arrays in delegate when reactive=true #11695
[kotlin-spring] fix #9902 use coroutine Flow for arrays in delegate when reactive=true #11695
Conversation
Looking forward to seeing this get merged - really need it! :-) |
The "node2" CircleCI tests failed. Looking at the reason for the failure, it seems to be something to do with the GoGinServer project, which my PR does not touch:
Could this be due to build flakiness? |
@giveadamakick thanks for the PR. Please ignore the CircleCI node 2 failure for the time being. cc @jimschubert (2017/09) ❤️, @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) |
I tested with petstore.yaml but got the following errors:
Can you please take a look when you've time? command to test:
|
@wing328 update on the above: the problem that occurs on |
…egate for bodyParams
@wing328 ok, I've worked out the cause of the compilation error you reported using petstore.yaml. The sample petstore API contains endpoints that take an array as a value for a query parameter. In the API, these values are modeled as a Kotlin Initially, I tried to change the types of the array query parameters to also be a I've made this change in the latest commit, just pushed. |
@giveadamakick thanks for the prompt fix and the detailed explanation. Tested again and the result is good. Will add some tests to CI to cover this. Have a nice weekend. |
This PR fixes the problem described in issue #9902, which I'll summarize here:
kotlin-spring
generator, withdelegatePattern
andreactive
set to true, the generated API file should use a Kotlin coroutine-typeFlow
when dealing with an OpenAPIarray
data type.requestBody
parameter, it does this for a generated API class, but not for a generated Delegate class. In generated Delegate classes, an array type that is the request body is generated as akotlin.collections.List
instead of aFlow
.Flow
to a Delegate that is expecting akotlin.collections.List
.To fix this, I have made the following changes:
Flow
when therequestBody
parameter is an array.How to validate
delegatePattern
andreactive
set totrue
(see this example I used), run amvn install
without the changes in this PR. You'll see that the generated code does not compile.Flow
type for therequestBody
parameter.After running both
./bin/generate-samples.sh
and./bin/utils/export_docs_generators.sh
, no extra files were generated, so nothing extra to include in this PR.Mentioning Kotlin technical committee members: @jimschubert @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(5.3.0),6.0.x