You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the openapi-generator Java Maven plugin to produce an html-doc from an openapi.yml with the html2-generator.
The resulting html (more precisely JavaScript) has invalid empty schemas.
The browser reports "Uncaught SyntaxError: Unexpected token ';'" and the schema fields are shown empty.
In our case this problem occurs since version 6.2.0. The official releases from 5.4.0 to 6.1.0 produce correct html.
The resulting javascript code in the generated html of version 6.2.0 and 6.3.0:
Take a look at "var schemaWrapper = ;"
<script>
$(document).ready(function() {// this should contain a schema in json format (and it does for us in versions 5.4.0 - 6.1.0)varschemaWrapper=;// --------------------------------varschema=findNode('schema',schemaWrapper).schema;if(!schema){
schema =schemaWrapper.schema;}
...
</script>
There are no error logs hinting at a configuration error. The openapi.yml used for conversion was identical between versions 5.4.0 to 6.1.0 and 6.2.0 to 6.3.0, except for the order of http 200 and http 4xx responses.
openapi-generator version
Tested on official maven releases from 5.4.0 up to 6.3.0.
5.4.0 to 6.1.0 produces correct results.
6.2.0 and 6.3.0 produce the empty schemas.
Steps to reproduce
Generate an html documentation page with swagger schemas using html2-generator in Version 6.2.0 or 6.3.0.
The YAML we are using contains $ref to schemas:
apiInfo.apis.operation.responses.schema seems to be the result of toString insteadof the actual hierarchy. This is what got inserted in the template in my testing:
Maybe jmustache doesn't search the parent context if the current one is a simple value?
Because {{{jsonSchema}}} is empty when nesting it in {#schema}. Using {#content} insteadof {#schema} in order to check whether there is a response body worked in my case.
Description
We are using the openapi-generator Java Maven plugin to produce an html-doc from an openapi.yml with the html2-generator.
The resulting html (more precisely JavaScript) has invalid empty schemas.
The browser reports "Uncaught SyntaxError: Unexpected token ';'" and the schema fields are shown empty.
In our case this problem occurs since version 6.2.0. The official releases from 5.4.0 to 6.1.0 produce correct html.
The resulting javascript code in the generated html of version 6.2.0 and 6.3.0:
Take a look at "var schemaWrapper = ;"
The plugin configuration of our pom.xml:
There are no error logs hinting at a configuration error. The openapi.yml used for conversion was identical between versions 5.4.0 to 6.1.0 and 6.2.0 to 6.3.0, except for the order of http 200 and http 4xx responses.
openapi-generator version
Tested on official maven releases from 5.4.0 up to 6.3.0.
5.4.0 to 6.1.0 produces correct results.
6.2.0 and 6.3.0 produce the empty schemas.
Steps to reproduce
Generate an html documentation page with swagger schemas using html2-generator in Version 6.2.0 or 6.3.0.
The YAML we are using contains $ref to schemas:
Related issues/PRs
I found the exact same issue on the swagger-codegen project which seems to have been fixed. For openapi-generator I could not find a report with this exact problem:
swagger-api/swagger-codegen#11911
swagger-api/swagger-codegen#11953
swagger-api/swagger-codegen-generators#1072
Suggest a fix
I found this file looking very similar to the one fixed in swagger-codegen project. So maybe it needs the same fix:
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/htmlDocs2/paramB.mustache
The text was updated successfully, but these errors were encountered: