Kaynağa Gözat

added check for schema

bubble
Tony Tam 10 yıl önce
ebeveyn
işleme
4d2ad25a10
6 değiştirilmiş dosya ile 67 ekleme ve 17 silme
  1. +31
    -6
      dist/lib/swagger-client.js
  2. +2
    -2
      dist/swagger-ui.js
  3. +1
    -1
      dist/swagger-ui.min.js
  4. +31
    -6
      lib/swagger-client.js
  5. +1
    -1
      src/main/coffeescript/view/OperationView.coffee
  6. +1
    -1
      src/main/coffeescript/view/ParameterView.coffee

+ 31
- 6
dist/lib/swagger-client.js Dosyayı Görüntüle

@@ -305,7 +305,7 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
tags = operation.tags;
}
var operationId = this.idFromOp(path, httpMethod, operation);
var operation = new Operation (
var operationObject = new Operation (
this,
operationId,
httpMethod,
@@ -325,11 +325,11 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
operationGroup.label = tag;
operationGroup.apis = [];
this[tag].help = this.help.bind(operationGroup);
this.apisArray.push(new OperationGroup(tag, operation));
this.apisArray.push(new OperationGroup(tag, operationObject));
}
operationGroup[operationId] = operation.execute.bind(operation);
operationGroup[operationId].help = operation.help.bind(operation);
operationGroup.apis.push(operation);
operationGroup[operationId] = operationObject.execute.bind(operationObject);
operationGroup[operationId].help = operationObject.help.bind(operationObject);
operationGroup.apis.push(operationObject);

// legacy UI feature
var j;
@@ -340,7 +340,7 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
}
}
if(api) {
api.operationsArray.push(operation);
api.operationsArray.push(operationObject);
}
}
}
@@ -405,6 +405,7 @@ var OperationGroup = function(tag, operation) {
var Operation = function(parent, operationId, httpMethod, path, args, definitions) {
var errors = [];
this.operation = args;
this.deprecated = args.deprecated;
this.consumes = args.consumes;
this.produces = args.produces;
this.parent = parent;
@@ -439,6 +440,30 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition
response = responses['200'];
defaultResponseCode = '200';
}
else if(responses['201']) {
response = responses['201'];
defaultResponseCode = '201';
}
else if(responses['202']) {
response = responses['202'];
defaultResponseCode = '202';
}
else if(responses['203']) {
response = responses['203'];
defaultResponseCode = '203';
}
else if(responses['204']) {
response = responses['204'];
defaultResponseCode = '204';
}
else if(responses['205']) {
response = responses['205'];
defaultResponseCode = '205';
}
else if(responses['206']) {
response = responses['206'];
defaultResponseCode = '206';
}
else if(responses['default']) {
response = responses['default'];
defaultResponseCode = 'default';


+ 2
- 2
dist/swagger-ui.js Dosyayı Görüntüle

@@ -1755,7 +1755,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
type = param.type || param.dataType;
if (typeof type === 'undefined') {
schema = param.schema;
if (schema['$ref']) {
if (schema && schema['$ref']) {
ref = schema['$ref'];
if (ref.indexOf('#/definitions/') === 0) {
type = ref.substring('#/definitions/'.length);
@@ -2209,7 +2209,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
type = this.model.type || this.model.dataType;
if (typeof type === 'undefined') {
schema = this.model.schema;
if (schema['$ref']) {
if (schema && schema['$ref']) {
ref = schema['$ref'];
if (ref.indexOf('#/definitions/') === 0) {
type = ref.substring('#/definitions/'.length);


+ 1
- 1
dist/swagger-ui.min.js
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 31
- 6
lib/swagger-client.js Dosyayı Görüntüle

@@ -305,7 +305,7 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
tags = operation.tags;
}
var operationId = this.idFromOp(path, httpMethod, operation);
var operation = new Operation (
var operationObject = new Operation (
this,
operationId,
httpMethod,
@@ -325,11 +325,11 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
operationGroup.label = tag;
operationGroup.apis = [];
this[tag].help = this.help.bind(operationGroup);
this.apisArray.push(new OperationGroup(tag, operation));
this.apisArray.push(new OperationGroup(tag, operationObject));
}
operationGroup[operationId] = operation.execute.bind(operation);
operationGroup[operationId].help = operation.help.bind(operation);
operationGroup.apis.push(operation);
operationGroup[operationId] = operationObject.execute.bind(operationObject);
operationGroup[operationId].help = operationObject.help.bind(operationObject);
operationGroup.apis.push(operationObject);

// legacy UI feature
var j;
@@ -340,7 +340,7 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
}
}
if(api) {
api.operationsArray.push(operation);
api.operationsArray.push(operationObject);
}
}
}
@@ -405,6 +405,7 @@ var OperationGroup = function(tag, operation) {
var Operation = function(parent, operationId, httpMethod, path, args, definitions) {
var errors = [];
this.operation = args;
this.deprecated = args.deprecated;
this.consumes = args.consumes;
this.produces = args.produces;
this.parent = parent;
@@ -439,6 +440,30 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition
response = responses['200'];
defaultResponseCode = '200';
}
else if(responses['201']) {
response = responses['201'];
defaultResponseCode = '201';
}
else if(responses['202']) {
response = responses['202'];
defaultResponseCode = '202';
}
else if(responses['203']) {
response = responses['203'];
defaultResponseCode = '203';
}
else if(responses['204']) {
response = responses['204'];
defaultResponseCode = '204';
}
else if(responses['205']) {
response = responses['205'];
defaultResponseCode = '205';
}
else if(responses['206']) {
response = responses['206'];
defaultResponseCode = '206';
}
else if(responses['default']) {
response = responses['default'];
defaultResponseCode = 'default';


+ 1
- 1
src/main/coffeescript/view/OperationView.coffee Dosyayı Görüntüle

@@ -97,7 +97,7 @@ class OperationView extends Backbone.View
type = param.type || param.dataType
if typeof type is 'undefined'
schema = param.schema
if schema['$ref']
if schema and schema['$ref']
ref = schema['$ref']
if ref.indexOf('#/definitions/') is 0
type = ref.substring('#/definitions/'.length)


+ 1
- 1
src/main/coffeescript/view/ParameterView.coffee Dosyayı Görüntüle

@@ -12,7 +12,7 @@ class ParameterView extends Backbone.View

if typeof type is 'undefined'
schema = @model.schema
if schema['$ref']
if schema and schema['$ref']
ref = schema['$ref']
if ref.indexOf('#/definitions/') is 0
type = ref.substring('#/definitions/'.length)


Yükleniyor…
İptal
Kaydet