OpenAPITools / OpenAPITools/openapi-generator

[BUG] html generator output has unescaped xml

Open
#13,733 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

HTML generated by the html generator has unescaped XML in the examples section.

Preview:


  123456789
  doggie
  
    aeiou
  
  
  
  aeiou

Code generated:

<pre class="example"><code><pet>
 <id>123456789</id>
 <name>doggie</name>
 <photourls>
   <photourls>aeiou</photourls>
 </photourls>
 <tags>
 </tags>
 <status>aeiou</status>
</pet></code></pre>

Code expected:

&lt;pre class="example"&gt;&lt;code&gt;&lt;pet&gt;
  &lt;id&gt;123456789&lt;/id&gt;
  &lt;name&gt;doggie&lt;/name&gt;
  &lt;photourls&gt;
    &lt;photourls&gt;aeiou&lt;/photourls&gt;
  &lt;/photourls&gt;
  &lt;tags&gt;
  &lt;/tags&gt;
  &lt;status&gt;aeiou&lt;/status&gt;
&lt;/pet&gt;&lt;/code&gt;&lt;/pre&gt;
openapi-generator version

Latest master. The tool prints 6.2.1-SNAPSHOT

OpenAPI declaration file content or url

modules/openapi-generator/src/test/resources/3_0/petstore.yaml from the repo itself.

Steps to reproduce
java -jar ./modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g html -o /tmp/index.html
Related issues/PRs

Multiple issues related to HTML entities, but none related to unescaped XML, it seems.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the documented generate command with modules/openapi-generator/src/test/resources/3_0/petstore.yaml and inspect the html generator's examples section. Compare the generated output with the expected escaped markup; done means XML tags appear as HTML entities rather than rendered as XML.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, java
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.