Uh oh!
There was an error while loading. Please reload this page.
Avoid generating uncompilable response body in Spring's API template - #8691
Avoid generating uncompilable response body in Spring's API template#8691smasset wants to merge 4 commits into
Conversation
e5bd6a1 to
e202250CompareRebased against current master. Should fix #9055 Not sure why |
e202250 to
ceb93f9Comparesmasset
commented
Apr 20, 2019
Rebased against current master |
smasset
commented
Apr 20, 2019
I can confirm this fixes #9055. With provided example, only removing duplicate white space in generated example string made the class compilable. Duplicating the billingAccounts property in CustomerAccount definition to a total of 10 instances illustrates the use of StringBuilder. |
smasset
commented
Apr 20, 2019
Attaching ZIP archive with API interfaces generated by version 2.3.1 of swagger-codegen and by a snapshot with my proposed fix (with vanilla sample provided in #9055 and with extra array properties to demonstrate the use of StringBuilder) |
ceb93f9 to
3a262c3Comparedrej1
commented
Jan 15, 2021
Hi @smasset , I appologize, I missed the notification. We checked your solution out and it's working... is it possible to merge it into the upcoming version? |
…ting uncompilable example code
3a262c3 to
b32c46aComparesmasset
commented
Jan 18, 2021
Hey @drej1. I've just rebased against latest master and didn't get any conflict. |
smasset
commented
Jan 18, 2021
All checks passed. @frantuma can you include this PR in the next release ? |
drej1
commented
Jan 18, 2021
drej1
commented
Feb 18, 2021
Hi @diyfr, can you or somebody from the team check this PR and include it into the next release of 2.x (and also 3.x)? |
diyfr
commented
Feb 18, 2021
drej1
commented
Jul 16, 2021
drej1
commented
Feb 2, 2022
diyfr
commented
Apr 28, 2023
Xerocry
commented
Apr 28, 2023
@diyfr Maybe I misunderstood something but that is a fix for OpenApi generator, not swagger codegen, no? |
diyfr
commented
Apr 28, 2023
Check, it's present on master branch |
Correct me if I'm wrong but there are only lambdaEscapeDoubleQuote and lambdaRemoveLineBreak in master, no lambdaTrimWhitespace*lambdaSplitString* |
diyfr
commented
Apr 28, 2023
@Xerocry I suggest you propose a new PR. this one is based on an obsolete branch |
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.3.0.0branch for changes related to OpenAPI spec 3.0. Default:master.Description of the PR
If definitions start to get complicated, example response bodies can exceed Java compiler's limit for constant strings.
This PR addresses this issue by introducing and using two new lambdas to remove any unnecessary whitespace and (if still needed) to split the constant string into smaller compilable parts using a StringBuilder to merge them back again.
Fixes#9055