added api info
This commit is contained in:
28
dist/css/screen.css
vendored
28
dist/css/screen.css
vendored
@@ -1757,3 +1757,31 @@ pre code {
|
||||
.message-fail {
|
||||
color: #cc0000;
|
||||
}
|
||||
|
||||
.info_title {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 10px;
|
||||
font-weight: bold;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.info_description {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 10px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.info_tos {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info_license {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info_contact {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
5
dist/index.html
vendored
5
dist/index.html
vendored
@@ -20,9 +20,8 @@
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
url:"http://petstore.swagger.wordnik.com/api/api-docs.json",
|
||||
dom_id:"swagger-ui-container",
|
||||
supportHeaderParams: false,
|
||||
url: "http://localhost:8002/api/api-docs",
|
||||
dom_id: "swagger-ui-container",
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
if(console) {
|
||||
|
||||
5
dist/lib/swagger.js
vendored
5
dist/lib/swagger.js
vendored
@@ -15,6 +15,8 @@
|
||||
|
||||
SwaggerApi.prototype.authorizationScheme = null;
|
||||
|
||||
SwaggerApi.prototype.info = null;
|
||||
|
||||
function SwaggerApi(url, options) {
|
||||
if (options == null) {
|
||||
options = {};
|
||||
@@ -71,6 +73,9 @@
|
||||
}
|
||||
_this.apis = {};
|
||||
_this.apisArray = [];
|
||||
if (response.info != null) {
|
||||
_this.info = response.info;
|
||||
}
|
||||
isApi = false;
|
||||
_ref = response.apis;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
|
||||
109
dist/swagger-ui.js
vendored
109
dist/swagger-ui.js
vendored
@@ -246,6 +246,99 @@ templates['main'] = template(function (Handlebars,depth0,helpers,partials,data)
|
||||
|
||||
function program1(depth0,data) {
|
||||
|
||||
var buffer = "", stack1, stack2;
|
||||
buffer += "\n <div class=\"info_title\">";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.title);
|
||||
if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
|
||||
else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.title", { hash: {} }); }
|
||||
buffer += escapeExpression(stack1) + "</div>\n <div class=\"info_description\">";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.description);
|
||||
if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
|
||||
else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.description", { hash: {} }); }
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "</div>\n ";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.termsOfServiceUrl);
|
||||
stack2 = helpers['if'];
|
||||
tmp1 = self.program(2, program2, data);
|
||||
tmp1.hash = {};
|
||||
tmp1.fn = tmp1;
|
||||
tmp1.inverse = self.noop;
|
||||
stack1 = stack2.call(depth0, stack1, tmp1);
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.contact);
|
||||
stack2 = helpers['if'];
|
||||
tmp1 = self.program(4, program4, data);
|
||||
tmp1.hash = {};
|
||||
tmp1.fn = tmp1;
|
||||
tmp1.inverse = self.noop;
|
||||
stack1 = stack2.call(depth0, stack1, tmp1);
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.license);
|
||||
stack2 = helpers['if'];
|
||||
tmp1 = self.program(6, program6, data);
|
||||
tmp1.hash = {};
|
||||
tmp1.fn = tmp1;
|
||||
tmp1.inverse = self.noop;
|
||||
stack1 = stack2.call(depth0, stack1, tmp1);
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
return buffer;}
|
||||
function program2(depth0,data) {
|
||||
|
||||
var buffer = "", stack1;
|
||||
buffer += "<div class=\"info_tos\"><a href=\"";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.termsOfServiceUrl);
|
||||
if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
|
||||
else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.termsOfServiceUrl", { hash: {} }); }
|
||||
buffer += escapeExpression(stack1) + "\">Terms of service</a></div>";
|
||||
return buffer;}
|
||||
|
||||
function program4(depth0,data) {
|
||||
|
||||
var buffer = "", stack1;
|
||||
buffer += "<div class='info_contact'><a href=\"mailto:";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.contact);
|
||||
if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
|
||||
else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.contact", { hash: {} }); }
|
||||
buffer += escapeExpression(stack1) + "\">Contact the developer</a></div>";
|
||||
return buffer;}
|
||||
|
||||
function program6(depth0,data) {
|
||||
|
||||
var buffer = "", stack1;
|
||||
buffer += "<div class='info_license'><a href='";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.licenseUrl);
|
||||
if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
|
||||
else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.licenseUrl", { hash: {} }); }
|
||||
buffer += escapeExpression(stack1) + "'>";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack1 = (stack1 === null || stack1 === undefined || stack1 === false ? stack1 : stack1.license);
|
||||
if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
|
||||
else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "info.license", { hash: {} }); }
|
||||
buffer += escapeExpression(stack1) + "</a></div>";
|
||||
return buffer;}
|
||||
|
||||
function program8(depth0,data) {
|
||||
|
||||
var buffer = "", stack1;
|
||||
buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
|
||||
foundHelper = helpers.apiVersion;
|
||||
@@ -255,7 +348,17 @@ function program1(depth0,data) {
|
||||
buffer += escapeExpression(stack1) + "\n ";
|
||||
return buffer;}
|
||||
|
||||
buffer += "\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";
|
||||
buffer += "<div class='info' id='api_info'>\n ";
|
||||
foundHelper = helpers.info;
|
||||
stack1 = foundHelper || depth0.info;
|
||||
stack2 = helpers['if'];
|
||||
tmp1 = self.program(1, program1, data);
|
||||
tmp1.hash = {};
|
||||
tmp1.fn = tmp1;
|
||||
tmp1.inverse = self.noop;
|
||||
stack1 = stack2.call(depth0, stack1, tmp1);
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n</div>\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";
|
||||
foundHelper = helpers.basePath;
|
||||
stack1 = foundHelper || depth0.basePath;
|
||||
if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
|
||||
@@ -264,7 +367,7 @@ function program1(depth0,data) {
|
||||
foundHelper = helpers.apiVersion;
|
||||
stack1 = foundHelper || depth0.apiVersion;
|
||||
stack2 = helpers['if'];
|
||||
tmp1 = self.program(1, program1, data);
|
||||
tmp1 = self.program(8, program8, data);
|
||||
tmp1.hash = {};
|
||||
tmp1.fn = tmp1;
|
||||
tmp1.inverse = self.noop;
|
||||
@@ -1402,6 +1505,8 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
|
||||
SwaggerUi.prototype.render = function() {
|
||||
var _this = this;
|
||||
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
|
||||
console.log("here it comes!");
|
||||
console.log(this.api);
|
||||
this.mainView = new MainView({
|
||||
model: this.api,
|
||||
el: $('#' + this.dom_id)
|
||||
|
||||
2
dist/swagger-ui.min.js
vendored
2
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -15,6 +15,8 @@
|
||||
|
||||
SwaggerApi.prototype.authorizationScheme = null;
|
||||
|
||||
SwaggerApi.prototype.info = null;
|
||||
|
||||
function SwaggerApi(url, options) {
|
||||
if (options == null) {
|
||||
options = {};
|
||||
@@ -71,6 +73,9 @@
|
||||
}
|
||||
_this.apis = {};
|
||||
_this.apisArray = [];
|
||||
if (response.info != null) {
|
||||
_this.info = response.info;
|
||||
}
|
||||
isApi = false;
|
||||
_ref = response.apis;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
|
||||
@@ -50,6 +50,8 @@ class SwaggerUi extends Backbone.Router
|
||||
# so it gets called when SwaggerApi completes loading
|
||||
render:() ->
|
||||
@showMessage('Finished Loading Resource Information. Rendering Swagger UI...')
|
||||
console.log "here it comes!"
|
||||
console.log @api
|
||||
@mainView = new MainView({model: @api, el: $('#' + @dom_id)}).render()
|
||||
@showMessage()
|
||||
switch @options.docExpansion
|
||||
|
||||
@@ -1757,3 +1757,31 @@ pre code {
|
||||
.message-fail {
|
||||
color: #cc0000;
|
||||
}
|
||||
|
||||
.info_title {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 10px;
|
||||
font-weight: bold;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.info_description {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 10px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.info_tos {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info_license {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info_contact {
|
||||
padding-left: 25px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
@@ -20,9 +20,8 @@
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
url:"http://petstore.swagger.wordnik.com/api/api-docs.json",
|
||||
dom_id:"swagger-ui-container",
|
||||
supportHeaderParams: false,
|
||||
url: "http://localhost:8002/api/api-docs",
|
||||
dom_id: "swagger-ui-container",
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
if(console) {
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
|
||||
<div class='info' id='api_info'>
|
||||
{{#if info}}
|
||||
<div class="info_title">{{info.title}}</div>
|
||||
<div class="info_description">{{{info.description}}}</div>
|
||||
{{#if info.termsOfServiceUrl}}<div class="info_tos"><a href="{{info.termsOfServiceUrl}}">Terms of service</a></div>{{/if}}
|
||||
{{#if info.contact}}<div class='info_contact'><a href="mailto:{{info.contact}}">Contact the developer</a></div>{{/if}}
|
||||
{{#if info.license}}<div class='info_license'><a href='{{info.licenseUrl}}'>{{info.license}}</a></div>{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class='container' id='resources_container'>
|
||||
<ul id='resources'>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user