You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Limiting number of empty line breaks in Mustache output is a known issue and it seems there will be no "fix" for that coming from Mustache team.
Example (generated with latest master):
/** * Unique identifier for this bid. Read-only. * @return id **/@ApiModelProperty(value = "Unique identifier for this bid. Read-only.")
publicLonggetId() {
returnid;
}
This is clearly broken.
While Mustache is unable to fix this issue themselves (due to the way it generates output), Swagger Codegen can roll its own fix, following the example as outlined in that same issue.
Short summary: use some special non-whitespace character to represent line break in all templates. Post-process output from Mustache, removing all line breaks (\n) and replacing the special character with line breaks instead.
Swagger-codegen version
All versions so far.
The text was updated successfully, but these errors were encountered:
Yeah, I looked at the source code and saw such usage. While it does reduce whitespace it is still quite difficult to figure out what will be the exact output. And this is also rather error prone.
My proposal would make it much more explicit and less error prone. But I admit, it is quite a radical change which will most likely break any custom templates out there that users have written themselves.
It will also require someone to go over the existing templates and make sure that line breaks are added in all the right places.
So I think my proposal is still better - easy to understand and reason about, resulting in better template readability and more pull requests from users.
Description
Limiting number of empty line breaks in Mustache output is a known issue and it seems there will be no "fix" for that coming from Mustache team.
Example (generated with latest master):
This is clearly broken.
While Mustache is unable to fix this issue themselves (due to the way it generates output), Swagger Codegen can roll its own fix, following the example as outlined in that same issue.
Short summary: use some special non-whitespace character to represent line break in all templates. Post-process output from Mustache, removing all line breaks (\n) and replacing the special character with line breaks instead.
Swagger-codegen version
All versions so far.
The text was updated successfully, but these errors were encountered: