Skip to content

Commit 1379944

Browse files
committed
Merge pull request #654 from illicitonion/spuriousdiv
Remove spurious </div> from empty object response schema
2 parents c1c60d4 + ab9f2fa commit 1379944

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

browser/swagger-client.js

Lines changed: 5 additions & 3 deletions
Large diffs are not rendered by default.

browser/swagger-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/schema-markup.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ function schemaToHTML(name, schema, models, modelPropertyMacro) {
469469
html += '<div>' + addReference(schema, name) + '</div>';
470470
} else if (type === 'object') {
471471
if (_.isPlainObject(schema.properties)) {
472-
html += _.map(schema.properties, function (property, name) {
472+
var contents = _.map(schema.properties, function (property, name) {
473473
var propertyIsRequired = (_.indexOf(schema.required, name) >= 0);
474474
var cProperty = _.cloneDeep(property);
475475

@@ -520,7 +520,9 @@ function schemaToHTML(name, schema, models, modelPropertyMacro) {
520520
}).join(',</div>');
521521
}
522522

523-
html += '</div>';
523+
if (contents) {
524+
html += contents + '</div>';
525+
}
524526
} else {
525527
html += '<div>' + primitiveToOptionsHTML(schema, type) + '</div>';
526528
}

0 commit comments

Comments
 (0)