Split operation with multiple return types#12462
Conversation
|
Thanks for the PR. Please resolve the merge conflicts when you've time. |
|
@wing328 done. please check |
There was a problem hiding this comment.
Do we need to make similar change in the CLI as well?
There was a problem hiding this comment.
@wing328 you talk about this repo https://github.com/OpenAPITools/openapi-generator-cli ?
There was a problem hiding this comment.
The openapi generator cli module in this project
…rator into split-operation-witl-multiple-retur-types � Conflicts: � modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java
ac4c5ad to
48db0e0
Compare
|
We already store multiple response media types in the Java layer in CodegenResponse.content |
|
@spacether my implementation is cross language/library |
|
@wing328 could you please check |
|
Hi folks! Currently bumping into this issue in the TypeScript node generator, so having a global way to deal with it seems like a great way to go. |
|
Hi, I try it on my own open api file, i find the names of generated functions are not very good. Do you ever consider multiple request content types? |
|
@Christina0114 what do you mean by "not very good names"?
Not as for now |
…rator into split-operation-witl-multiple-retur-types � Conflicts: � modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java
|
Hi @wing328 |
Using the Java layer data that already existing on master branch is also a is cross language/library solution In 3.0.X specs, a response doe not have a datatype. It's content object has a datatype per the spec: Please consider using CodegenResponse.content because
You can iterate over it and generate multiple interfaces/fns/classes with separate return types. |
This is a fix for issues like
There might be even more like those. The general idea of this PR is to split operation with different return types(content types) into multiple. While request for this feature was only for Spring, I did a global change since it was simpler to do in core, rather then in specific generator.
New flag is introduced to control this behavior and it's disabled by default
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.
Core team since this affects default generator: @wing328 @jimschubert @cbornet @jmini @etherealjoy @spacether
And java related committee since tests currently written for java/spring only:
@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10)
@cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02)