openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG] html generator output has unescaped xml

Open nandedamana opened this issue 3 years ago • 0 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [x] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [x] 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.

nandedamana avatar Oct 18 '22 16:10 nandedamana