[html] Lists in response description, model description and property description are not generated properly.
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- html
- Domain
- documentation
Research direction
Start with src/main/resources/handlebars/htmlDocs/index.mustache and inspect the response, model, and property description expressions shown in the issue. Generate the HTML documentation from the supplied OpenAPI example and verify that all list descriptions render as HTML lists rather than escaped tags.
Written by the indexing model from the issue text.
Description
As far as I know, the 'description' property in the swagger spec supports lists using * like:
* item1: 1
* item2: 2
The method description is correctly rendered as:
- item1: 1
- item2: 2
but in the response, model and property description it is incorrectly rendered as:
<ul> <li>item1: 1</li> <li>item2: 2</li> </ul>
There is a merged PR that solved the problem for the method description but not for the other cases (https://github.com/swagger-api/swagger-codegen-generators/pull/982)
This is a sample that shows the problem:
openapi: 3.0.0
info:
title: API
description: Process.
version: 1.0.0
tags:
- name: info
description: Provides info.
paths:
/info:
post:
description: |
Right:
* item1: 1
* item2: 2
responses:
"200":
description: |
Wrong:
* item3: 3
* item4: 4
content:
application/json:
schema:
$ref: "#/components/schemas/Object"
components:
schemas:
Object:
description: |
Wrong:
* item5: 5
* item6: 6
type: object
properties:
prop:
description: |
Wrong:
* item7: 7
* item8: 8
This is a diff that solves the problem:
diff --git a/src/main/resources/handlebars/htmlDocs/index.mustache b/src/main/resources/handlebars/htmlDocs/index.mustache
index 6d2c2001..d68a64c8 100644
--- a/src/main/resources/handlebars/htmlDocs/index.mustache
+++ b/src/main/resources/handlebars/htmlDocs/index.mustache
@@ -133,7 +133,7 @@
<h3 class="field-label">Responses</h3>
{{#responses}}
<h4 class="field-label">{{code}}</h4>
- {{message}}
+ {{{message}}}
{{#simpleType}}<a href="#{{dataType}}">{{dataType}}</a>{{/simpleType}}
{{#examples}}
<h3 class="field-label">Example data</h3>
@@ -164,9 +164,9 @@
{{#model}}
<div class="model">
<h3><a name="{{name}}"><code>{{name}}</code>{{#title}} - {{title}}{{/title}}</a> <a class="up" href="#__Models">Up</a></h3>
- {{#unescapedDescription}}<div class='model-description'>{{unescapedDescription}}</div>{{/unescapedDescription}}
+ {{#unescapedDescription}}<div class='model-description'>{{{unescapedDescription}}}</div>{{/unescapedDescription}}
<div class="field-items">
- {{#vars}}<div class="param">{{name}} {{^required}}(optional){{/required}}</div><div class="param-desc"><span class="param-type">{{#isNot this 'primitive-type'}}<a href="#{{complexType}}">{{datatype}}</a>{{/isNot}}</span> {{unescapedDescription}} {{#dataFormat}}format: {{{dataFormat}}}{{/dataFormat}}</div>
+ {{#vars}}<div class="param">{{name}} {{^required}}(optional){{/required}}</div><div class="param-desc"><span class="param-type">{{#isNot this 'primitive-type'}}<a href="#{{complexType}}">{{datatype}}</a>{{/isNot}}</span> {{{unescapedDescription}}} {{#dataFormat}}format: {{{dataFormat}}}{{/dataFormat}}</div>
{{#is this 'enum'}}
<div class="param-enum-header">Enum:</div>
{{#_enum}}<div class="param-enum">{{this}}</div>{{/_enum}}
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from swagger-api/swagger-codegen-generators
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Python generated code: Delete API Requests can be blocked in API Gateways when sends empty body Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
swagger-api/swagger-codegen-generators#1370 · 3 comments · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
All issues in swagger-api/swagger-codegen-generators
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·