[REQ] Support multiline and complex formatting in `description` fields
Created by: zippolyte
Is your feature request related to a problem? Please describe.
Many description fields for paths, parameters, or even the main description of the client need to be more than just one line long, and might even be markdown formatted.
This can in theory be done in the specification file, thanks to the YAML syntax for multiline strings with |
or >
.
The problem is that when rendering the .md
files for the documentation, the generator takes the escaped string in the description, which basically removes every new line and prevent any formatting to be done, like in this issue https://github.com/OpenAPITools/openapi-generator/issues/3704 for instance.
Describe the solution you'd like
I would like to be able to specify markdown in my template descriptions
A solution I see could be to use the unescaped variant of the multiline string.
For example: use {{{unescapedNotes}}}
instead of {{notes}}
in https://github.com/OpenAPITools/openapi-generator/blob/e9a0a51b505ad0c376dc87c90586aad08b0a18a3/modules/openapi-generator/src/main/resources/Java/api_doc.mustache#L21
Describe alternatives you've considered
Another alternative, if the fully unescaped string is a problem, would be to provide and use the escapeTextWhileAllowingNewLines
version of the string. (see https://github.com/OpenAPITools/openapi-generator/blob/e9a0a51b505ad0c376dc87c90586aad08b0a18a3/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java#L561)