ソースを参照

Merge branch 'issue-2427'

bubble
Tony Tam 7年前
コミット
20aa9643d3
4個のファイルの変更119行の追加44行の削除
  1. +74
    -28
      dist/swagger-ui.js
  2. +8
    -8
      dist/swagger-ui.min.js
  3. +15
    -2
      src/main/javascript/view/OperationView.js
  4. +22
    -6
      src/main/javascript/view/partials/signature.js

+ 74
- 28
dist/swagger-ui.js
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 8
- 8
dist/swagger-ui.min.js
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 15
- 2
src/main/javascript/view/OperationView.js ファイルの表示

@@ -83,7 +83,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
},

// Note: copied from CoffeeScript compiled file
// TODO: redactor
// TODO: refactor
render: function() {
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, isJSON;
isMethodSubmissionSupported = jQuery.inArray(this.model.method, this.model.supportedSubmitMethods()) >= 0;
@@ -672,6 +672,17 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
contentType = contentType.split(';')[0].trim();
}
}
if(contentType) {
if(typeof content === 'string') {
var arrayBuffer = new ArrayBuffer(content.length);
var uint8Array = new Uint8Array(arrayBuffer);
for (var i = 0; i < content.length; i++) {
uint8Array[i] = content.charCodeAt(i);
}

content = new Blob([uint8Array], { type: contentType });
}
}
$('.response_body', $(this.el)).removeClass('json');
$('.response_body', $(this.el)).removeClass('xml');

@@ -687,7 +698,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
pre = $('<pre class="json" />').append(code);

// JSON
} else if (headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
} else if (
contentType === 'application/octet-stream' ||
headers['Content-Disposition'] && (/attachment/).test(headers['Content-Disposition']) ||
headers['content-disposition'] && (/attachment/).test(headers['content-disposition']) ||
headers['Content-Description'] && (/File Transfer/).test(headers['Content-Description']) ||
headers['content-description'] && (/File Transfer/).test(headers['content-description'])) {


+ 22
- 6
src/main/javascript/view/partials/signature.js ファイルの表示

@@ -553,14 +553,30 @@ SwaggerUi.partials.signature = (function () {
modelsToIgnore[value.name] = value;

// Response support
if (value.examples && _.isPlainObject(value.examples) && value.examples['application/json']) {
value.definition.example = value.examples['application/json'];
if (value.examples && _.isPlainObject(value.examples)) {
value = _.cloneDeep(value);
var keys = Object.keys(value.examples);

_.forEach(keys, function(key) {
if(key.indexOf('application/json') === 0) {
var example = value.examples[key];
if (_.isString(example)) {
example = jsyaml.safeLoad(example);
}
value.definition.example = example;
return schemaToJSON(value.definition, example, modelsToIgnore, value.modelPropertyMacro);
}
});
}

if (_.isString(value.definition.example)) {
value.definition.example = jsyaml.safeLoad(value.definition.example);
if (value.examples) {
value = _.cloneDeep(value);
var example = value.examples;
if (_.isString(example)) {
example = jsyaml.safeLoad(example);
}
} else if (!value.definition.example) {
value.definition.example = value.examples;
value.definition.example = example;
return schemaToJSON(value.definition, example, modelsToIgnore, value.modelPropertyMacro);
}

return schemaToJSON(value.definition, value.models, modelsToIgnore, value.modelPropertyMacro);


読み込み中…
キャンセル
保存