Open segevfiner opened 4 years ago
👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
I believe we are having a similar issue potentially due to the org.openapitools.codegen.DefaultCodegen
generating escaped notes from the description.
op.unescapedNotes = operation.getDescription();
op.notes = escapeText(operation.getDescription());
markdown-documentation/api.moustache
defines
{{summary}}{{#notes}}
{{.}}{{/notes}}
our fix is to create a new template under markdown-documentation
{{summary}}{{#unescapedNotes}}
{{.}}{{/unescapedNotes}}
and use as a template - see https://openapi-generator.tech/docs/templating/
We are experiencing a problem getting this picked up currently however it makes sense to where the issue lies.
I had a similar error and managed to fix it by using @garyfeltham's comment with a specific change. I overrode the following in the api_doc.mustache
template for the target programming language.
Before:
{{summary}}{{#notes}}
{{.}}{{/notes}}
After:
{{summary}}{{#notes}}
{{{unescapedNotes}}}{{/notes}}
From mustache documentation:
All variables are HTML escaped by default. If you want to return raw contents without escaping, use the triple mustache: {{{name}}}.
In the docker run to use a custom template we need to:
Create a volume
-v ${ROOT}/src/main/docs/templates/Java:/local/CustomTemplate
specify template directory
-t /local/CustomTemplate
Bug Report Checklist
Description
A multiline description that renders fine in swagger-ui is generated to the top every single file and squished to a single line when generated in the go generator. I expected it to preserve newlines. ~Also note that Go doc comments are not markdown, a truly complete solution would need to transform the CommonMark to the minimal syntax supported by Go to avoid unexpected rendering issues.~ - Not a godoc comment, just a top of file comment, not rendered by godoc.
openapi-generator version
v4.2.6 and feeeedd34d4f3a83501825d025502874f669a6bc (Docker image
openapitools/openapi-generator-cli@sha256:4396b434b09f03c9cb9a20ff39f1406f13a9b224a25e77a41679cd993eb5c968
)OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix