Переглянути джерело

added validator for v2

bubble
Tony Tam 10 роки тому
джерело
коміт
8918fa1c24
5 змінених файлів з 1522 додано та 1435 видалено
  1. +1489
    -1429
      dist/lib/swagger.js
  2. +23
    -3
      dist/swagger-ui.js
  3. +1
    -1
      dist/swagger-ui.min.js
  4. +3
    -1
      src/main/coffeescript/view/MainView.coffee
  5. +6
    -1
      src/main/template/main.handlebars

+ 1489
- 1429
dist/lib/swagger.js
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 23
- 3
dist/swagger-ui.js Переглянути файл

@@ -293,6 +293,21 @@ function program8(depth0,data) {
return buffer;
}

function program10(depth0,data) {
var buffer = "", stack1;
buffer += "\n <span style=\"float:right\"><a href=\"http://online.swagger.io/validator/debug?url=";
if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "\"><img id=\"foo\" src=\"http://online.swagger.io/validator?url=";
if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "\"></a>\n </span>\n ";
return buffer;
}

buffer += "<div class='info' id='api_info'>\n ";
stack1 = helpers['if'].call(depth0, depth0.info, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
@@ -303,7 +318,10 @@ function program8(depth0,data) {
+ "\n ";
stack1 = helpers['if'].call(depth0, depth0.apiVersion, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "]</h4>\n </div>\n</div>\n";
buffer += "]\n ";
stack1 = helpers['if'].call(depth0, depth0.validatorUrl, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n </h4>\n </div>\n</div>\n";
return buffer;
});
})();
@@ -1483,13 +1501,15 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
}
}
}
log(this.model);
if (this.model.info && this.model.info.license && typeof this.model.info.license === 'string') {
name = this.model.info.license;
url = this.model.info.licenseUrl;
this.model.info.license = {};
this.model.info.license.name = name;
return this.model.info.license.url = url;
this.model.info.license.url = url;
}
if (this.model.url.indexOf('http://localhost') === -1 && this.model.swaggerVersion === 2) {
return this.model.validatorUrl = this.model.url;
}
};



+ 1
- 1
dist/swagger-ui.min.js
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 3
- 1
src/main/coffeescript/view/MainView.coffee Переглянути файл

@@ -14,13 +14,15 @@ class MainView extends Backbone.View
if (sorterName == "alpha") # sort top level paths if alpha
@model.apisArray.sort sorter

log @model
if @model.info and @model.info.license and typeof @model.info.license is 'string'
name = @model.info.license
url = @model.info.licenseUrl
@model.info.license = {}
@model.info.license.name = name
@model.info.license.url = url

if @model.url.indexOf('http://localhost') is -1 and @model.swaggerVersion is 2
@model.validatorUrl = @model.url
render: ->
# Render the outer container for resources


+ 6
- 1
src/main/template/main.handlebars Переглянути файл

@@ -17,6 +17,11 @@
<h4 style="color: #999">[ <span style="font-variant: small-caps">base url</span>: {{basePath}}
{{#if apiVersion}}
, <span style="font-variant: small-caps">api version</span>: {{apiVersion}}
{{/if}}]</h4>
{{/if}}]
{{#if validatorUrl}}
<span style="float:right"><a href="http://online.swagger.io/validator/debug?url={{url}}"><img id="foo" src="http://online.swagger.io/validator?url={{url}}"></a>
</span>
{{/if}}
</h4>
</div>
</div>

Завантаження…
Відмінити
Зберегти