Skip to content

Commit 0d335e4

Browse files
authored
Merge pull request #316 from swagger-api/html_issues_fix
[html2] issues fix
2 parents 94e2a37 + dce81c9 commit 0d335e4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,8 +3752,9 @@ protected Schema getSchemaFromResponse(ApiResponse response) {
37523752
return null;
37533753
}
37543754
Schema schema = null;
3755-
for (MediaType mediaType : response.getContent().values()) {
3756-
schema = mediaType.getSchema();
3755+
for (String contentType : response.getContent().keySet()) {
3756+
schema = response.getContent().get(contentType).getSchema();
3757+
schema.addExtension("x-content-type", contentType);
37573758
break;
37583759
}
37593760
return schema;

src/main/resources/handlebars/htmlDocs2/index.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@
344344
<script>
345345
$(document).ready(function() {
346346
var schemaWrapper = {{{jsonSchema}}};
347-
var schema = schemaWrapper.content[{{contentType}}].schema;
347+
var schema = schemaWrapper.content["{{extensions.x-content-type}}"].schema;
348348
if (schema.$ref != null) {
349349
schema = defsParser.$refs.get(schema.$ref);
350350
} else {

src/main/resources/handlebars/htmlDocs2/paramB.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<script>
66
$(document).ready(function() {
77
var schemaWrapper = {{{jsonSchema}}};
8-
var schema = schemaWrapper.content[{{contentType}}].schema;
8+
var schema = schemaWrapper.content["{{contentType}}"].schema;
99
if (schema.$ref != null) {
1010
schema = defsParser.$refs.get(schema.$ref);
1111
} else {

src/main/resources/mustache/htmlDocs2/index.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@
344344
<script>
345345
$(document).ready(function() {
346346
var schemaWrapper = {{{jsonSchema}}};
347-
var schema = schemaWrapper.content[{{contentType}}].schema;
347+
var schema = schemaWrapper.content["{{extensions.x-content-type}}"].schema;
348348
var schema = schemaWrapper.schema;
349349
if (schema.$ref != null) {
350350
schema = defsParser.$refs.get(schema.$ref);

0 commit comments

Comments
 (0)