Skip to content

Commit ea1bc5f

Browse files
committed
swagger-api#1248 createXMLSample prettified xml display
1 parent 17a14a4 commit ea1bc5f

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

css/print.css

+1
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@
365365
}
366366
.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav {
367367
display: block;
368+
min-width: 230px;
368369
margin: 0;
369370
padding: 0;
370371
}

css/screen.css

+1
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@
365365
}
366366
.swagger-section .swagger-ui-wrap .model-signature ul.signature-nav {
367367
display: block;
368+
min-width: 230px;
368369
margin: 0;
369370
padding: 0;
370371
}

swagger-ui.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -25343,7 +25343,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
2534325343
// Note: copied from CoffeeScript compiled file
2534425344
// TODO: redactor
2534525345
render: function() {
25346-
var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value;
25346+
var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, l, len, len1, len2, len3, len4, m, modelAuths, n, o, p, param, q, ref, ref1, ref2, ref3, ref4, ref5, responseContentTypeView, responseSignatureView, schema, schemaObj, scopeIndex, signatureModel, statusCode, successResponse, type, v, value, produces, isXML;
2534725347
isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
2534825348
if (!isMethodSubmissionSupported) {
2534925349
this.model.isReadOnly = true;
@@ -25422,6 +25422,13 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
2542225422
this.model.responseMessages = [];
2542325423
}
2542425424
signatureModel = null;
25425+
produces = this.model.produces;
25426+
isXML = produces.filter(function (val) {
25427+
if (val.indexOf('xml') > -1) {
25428+
return true;
25429+
}
25430+
}).length;
25431+
2542525432
if (this.model.successResponse) {
2542625433
successResponse = this.model.successResponse;
2542725434
for (key in successResponse) {
@@ -25433,6 +25440,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
2543325440
signatureModel = {
2543425441
sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2),
2543525442
isParam: false,
25443+
sampleXML: isXML ? SwaggerUi.partials.signature.createXMLSample(value.definition, value.models) : false,
2543625444
signature: SwaggerUi.partials.signature.getModelSignature(value.name, value.definition, value.models, value.modelPropertyMacro)
2543725445
};
2543825446
}
@@ -27031,7 +27039,7 @@ SwaggerUi.partials.signature = (function () {
2703127039
function createXMLSample (definition, models) {
2703227040
var prolog = '<?xml version="1.0"?>';
2703327041

27034-
return prolog + createSchemaXML('', definition, models);
27042+
return formatXml(prolog + createSchemaXML('', definition, models));
2703527043
}
2703627044

2703727045
return {

swagger-ui.min.js

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)