moved tests, added 1.x, 2.0
This commit is contained in:
8
dist/css/screen.css
vendored
8
dist/css/screen.css
vendored
@@ -294,7 +294,13 @@
|
||||
.swagger-section .swagger-ui-wrap .message-fail {
|
||||
color: #cc0000;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_contact {
|
||||
.swagger-section .swagger-ui-wrap .info_url {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_email {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_name {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_description {
|
||||
|
||||
26
dist/lib/swagger-client.js
vendored
26
dist/lib/swagger-client.js
vendored
@@ -379,9 +379,8 @@ SwaggerApi.prototype.buildFromSpec = function (response) {
|
||||
this.consumes = response.consumes;
|
||||
this.produces = response.produces;
|
||||
this.authSchemes = response.authorizations;
|
||||
if (response.info != null) {
|
||||
this.info = response.info;
|
||||
}
|
||||
this.info = this.convertInfo(response.info);
|
||||
|
||||
var isApi = false, i, res;
|
||||
for (i = 0; i < response.apis.length; i++) {
|
||||
var api = response.apis[i];
|
||||
@@ -429,9 +428,7 @@ SwaggerApi.prototype.buildFrom1_1Spec = function (response) {
|
||||
this.apis = {};
|
||||
this.apisArray = [];
|
||||
this.produces = response.produces;
|
||||
if (response.info != null) {
|
||||
this.info = response.info;
|
||||
}
|
||||
this.info = this.convertInfo(response.info);
|
||||
var isApi = false, res;
|
||||
for (var i = 0; i < response.apis.length; i++) {
|
||||
var api = response.apis[i];
|
||||
@@ -470,6 +467,23 @@ SwaggerApi.prototype.buildFrom1_1Spec = function (response) {
|
||||
return this;
|
||||
};
|
||||
|
||||
SwaggerApi.prototype.convertInfo = function (resp) {
|
||||
if(typeof resp == 'object') {
|
||||
var info = {}
|
||||
|
||||
info.title = resp.title;
|
||||
info.description = resp.description;
|
||||
info.termsOfService = resp.termsOfServiceUrl;
|
||||
info.contact = {};
|
||||
info.contact.name = resp.contact;
|
||||
info.license = {};
|
||||
info.license.name = resp.license;
|
||||
info.license.url = resp.licenseUrl;
|
||||
|
||||
return info;
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerApi.prototype.selfReflect = function () {
|
||||
var resource, resource_name, ref;
|
||||
if (this.apis === null) {
|
||||
|
||||
287
dist/swagger-ui.js
vendored
287
dist/swagger-ui.js
vendored
@@ -558,19 +558,19 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
|
||||
+ "\">Terms of service</a></div>";
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
|
||||
return "<div class='info_contact'>Created by "
|
||||
return "<div class='info_name'>Created by "
|
||||
+ escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.name : stack1), depth0))
|
||||
+ "</div>";
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
|
||||
return "<div class='info_contact'>See more at <a href=\""
|
||||
return "<div class='info_url'>See more at <a href=\""
|
||||
+ escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
|
||||
+ "\">"
|
||||
+ escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.url : stack1), depth0))
|
||||
+ "</a></div>";
|
||||
},"8":function(depth0,helpers,partials,data) {
|
||||
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression;
|
||||
return "<div class='info_contact'><a href=\"mailto:"
|
||||
return "<div class='info_email'><a href=\"mailto:"
|
||||
+ escapeExpression(lambda(((stack1 = ((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ? stack1.email : stack1), depth0))
|
||||
+ "?subject="
|
||||
+ escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
|
||||
@@ -869,62 +869,6 @@ this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(dep
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
|
||||
},"useData":true});
|
||||
this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
return " multiple='multiple'";
|
||||
},"3":function(depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"5":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
var stack1, helperMissing=helpers.helperMissing, buffer = "";
|
||||
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"7":function(depth0,helpers,partials,data) {
|
||||
return " <option selected=\"\" value=''></option>\n";
|
||||
},"9":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"10":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <option selected=\"\" value='"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ " (default)</option>\n";
|
||||
},"12":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <option value='"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "</option>\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n <select ";
|
||||
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += " class='parameter' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += " </select>\n</td>\n<td class=\"markdown\">";
|
||||
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td>";
|
||||
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
|
||||
},"useData":true});
|
||||
var MainView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__hasProp = {}.hasOwnProperty;
|
||||
@@ -948,7 +892,7 @@ MainView = (function(_super) {
|
||||
};
|
||||
|
||||
MainView.prototype.initialize = function(opts) {
|
||||
var auth, key, name, url, value, _ref;
|
||||
var auth, key, value, _ref;
|
||||
if (opts == null) {
|
||||
opts = {};
|
||||
}
|
||||
@@ -963,19 +907,6 @@ MainView = (function(_super) {
|
||||
};
|
||||
this.model.auths.push(auth);
|
||||
}
|
||||
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;
|
||||
this.model.info.license.url = url;
|
||||
}
|
||||
if (!this.model.info) {
|
||||
this.model.info = {};
|
||||
}
|
||||
if (!this.model.info.version) {
|
||||
this.model.info.version = this.model.apiVersion;
|
||||
}
|
||||
if (this.model.swaggerVersion === "2.0") {
|
||||
if ("validatorUrl" in opts.swaggerOptions) {
|
||||
return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
|
||||
@@ -1051,38 +982,61 @@ MainView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' readonly='readonly' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "</textarea>\n";
|
||||
this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
return " multiple='multiple'";
|
||||
},"3":function(depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"5":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " "
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "\n";
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
return " (empty)\n";
|
||||
var stack1, helperMissing=helpers.helperMissing, buffer = "";
|
||||
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"7":function(depth0,helpers,partials,data) {
|
||||
return " <option selected=\"\" value=''></option>\n";
|
||||
},"9":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"10":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <option selected=\"\" value='"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ " (default)</option>\n";
|
||||
},"12":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <option value='"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "</option>\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
|
||||
+ "</td>\n<td>\n <select ";
|
||||
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td class=\"markdown\">";
|
||||
buffer += " class='parameter' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += " </select>\n</td>\n<td class=\"markdown\">";
|
||||
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td>";
|
||||
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
|
||||
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
|
||||
},"useData":true});
|
||||
var OperationView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
@@ -1679,9 +1633,9 @@ OperationView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
|
||||
return " <textarea class='body-textarea' readonly='readonly' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
@@ -1699,7 +1653,7 @@ this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
return " (empty)\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
|
||||
@@ -1741,6 +1695,39 @@ ParameterContentTypeView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "</textarea>\n";
|
||||
},"3":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " "
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "\n";
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
return " (empty)\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td class=\"markdown\">";
|
||||
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td>";
|
||||
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
|
||||
},"useData":true});
|
||||
this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
|
||||
@@ -2010,6 +1997,35 @@ ResourceView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
var ResponseContentTypeView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__hasProp = {}.hasOwnProperty;
|
||||
|
||||
ResponseContentTypeView = (function(_super) {
|
||||
__extends(ResponseContentTypeView, _super);
|
||||
|
||||
function ResponseContentTypeView() {
|
||||
return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
ResponseContentTypeView.prototype.initialize = function() {};
|
||||
|
||||
ResponseContentTypeView.prototype.render = function() {
|
||||
var template;
|
||||
template = this.template();
|
||||
$(this.el).html(template(this.model));
|
||||
$('label[for=responseContentType]', $(this.el)).text('Response Content Type');
|
||||
return this;
|
||||
};
|
||||
|
||||
ResponseContentTypeView.prototype.template = function() {
|
||||
return Handlebars.templates.response_content_type;
|
||||
};
|
||||
|
||||
return ResponseContentTypeView;
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
return " : ";
|
||||
},"3":function(depth0,helpers,partials,data) {
|
||||
@@ -2048,56 +2064,6 @@ this["Handlebars"]["templates"]["resource"] = Handlebars.template({"1":function(
|
||||
+ escapeExpression(((helper = (helper = helpers.id || (depth0 != null ? depth0.id : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"id","hash":{},"data":data}) : helper)))
|
||||
+ "_endpoint_list' style='display:none'>\n\n</ul>\n";
|
||||
},"useData":true});
|
||||
var ResponseContentTypeView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__hasProp = {}.hasOwnProperty;
|
||||
|
||||
ResponseContentTypeView = (function(_super) {
|
||||
__extends(ResponseContentTypeView, _super);
|
||||
|
||||
function ResponseContentTypeView() {
|
||||
return ResponseContentTypeView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
ResponseContentTypeView.prototype.initialize = function() {};
|
||||
|
||||
ResponseContentTypeView.prototype.render = function() {
|
||||
var template;
|
||||
template = this.template();
|
||||
$(this.el).html(template(this.model));
|
||||
$('label[for=responseContentType]', $(this.el)).text('Response Content Type');
|
||||
return this;
|
||||
};
|
||||
|
||||
ResponseContentTypeView.prototype.template = function() {
|
||||
return Handlebars.templates.response_content_type;
|
||||
};
|
||||
|
||||
return ResponseContentTypeView;
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"2":function(depth0,helpers,partials,data) {
|
||||
var stack1, lambda=this.lambda, buffer = " <option value=\"";
|
||||
stack1 = lambda(depth0, depth0);
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "\">";
|
||||
stack1 = lambda(depth0, depth0);
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</option>\n";
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
return " <option value=\"application/json\">application/json</option>\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</select>\n";
|
||||
},"useData":true});
|
||||
var SignatureView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__hasProp = {}.hasOwnProperty;
|
||||
@@ -2170,13 +2136,26 @@ SignatureView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
|
||||
stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
|
||||
this["Handlebars"]["templates"]["response_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
|
||||
+ escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
|
||||
+ "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
|
||||
return buffer;
|
||||
},"2":function(depth0,helpers,partials,data) {
|
||||
var stack1, lambda=this.lambda, buffer = " <option value=\"";
|
||||
stack1 = lambda(depth0, depth0);
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "\">";
|
||||
stack1 = lambda(depth0, depth0);
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</option>\n";
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
return " <option value=\"application/json\">application/json</option>\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "<label for=\"responseContentType\"></label>\n<select name=\"responseContentType\">\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</select>\n";
|
||||
},"useData":true});
|
||||
var StatusCodeView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
@@ -2220,6 +2199,14 @@ StatusCodeView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["signature"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
|
||||
stack1 = ((helper = (helper = helpers.signature || (depth0 != null ? depth0.signature : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signature","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "\n </div>\n\n <div class=\"snippet\">\n <pre><code>"
|
||||
+ escapeExpression(((helper = (helper = helpers.sampleJSON || (depth0 != null ? depth0.sampleJSON : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"sampleJSON","hash":{},"data":data}) : helper)))
|
||||
+ "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
|
||||
},"useData":true});
|
||||
this["Handlebars"]["templates"]["status_code"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td width='15%' class='code'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.code || (depth0 != null ? depth0.code : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"code","hash":{},"data":data}) : helper)))
|
||||
|
||||
4
dist/swagger-ui.min.js
vendored
4
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -379,9 +379,8 @@ SwaggerApi.prototype.buildFromSpec = function (response) {
|
||||
this.consumes = response.consumes;
|
||||
this.produces = response.produces;
|
||||
this.authSchemes = response.authorizations;
|
||||
if (response.info != null) {
|
||||
this.info = response.info;
|
||||
}
|
||||
this.info = this.convertInfo(response.info);
|
||||
|
||||
var isApi = false, i, res;
|
||||
for (i = 0; i < response.apis.length; i++) {
|
||||
var api = response.apis[i];
|
||||
@@ -429,9 +428,7 @@ SwaggerApi.prototype.buildFrom1_1Spec = function (response) {
|
||||
this.apis = {};
|
||||
this.apisArray = [];
|
||||
this.produces = response.produces;
|
||||
if (response.info != null) {
|
||||
this.info = response.info;
|
||||
}
|
||||
this.info = this.convertInfo(response.info);
|
||||
var isApi = false, res;
|
||||
for (var i = 0; i < response.apis.length; i++) {
|
||||
var api = response.apis[i];
|
||||
@@ -470,6 +467,23 @@ SwaggerApi.prototype.buildFrom1_1Spec = function (response) {
|
||||
return this;
|
||||
};
|
||||
|
||||
SwaggerApi.prototype.convertInfo = function (resp) {
|
||||
if(typeof resp == 'object') {
|
||||
var info = {}
|
||||
|
||||
info.title = resp.title;
|
||||
info.description = resp.description;
|
||||
info.termsOfService = resp.termsOfServiceUrl;
|
||||
info.contact = {};
|
||||
info.contact.name = resp.contact;
|
||||
info.license = {};
|
||||
info.license.name = resp.license;
|
||||
info.license.url = resp.licenseUrl;
|
||||
|
||||
return info;
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerApi.prototype.selfReflect = function () {
|
||||
var resource, resource_name, ref;
|
||||
if (this.apis === null) {
|
||||
|
||||
@@ -11,19 +11,6 @@ class MainView extends Backbone.View
|
||||
auth = {name: key, type: value.type, value: value}
|
||||
@model.auths.push auth
|
||||
|
||||
|
||||
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.info
|
||||
@model.info = {}
|
||||
|
||||
if !@model.info.version
|
||||
@model.info.version = @model.apiVersion
|
||||
|
||||
if @model.swaggerVersion is "2.0"
|
||||
if "validatorUrl" of opts.swaggerOptions
|
||||
# Validator URL specified explicitly
|
||||
|
||||
@@ -294,7 +294,13 @@
|
||||
.swagger-section .swagger-ui-wrap .message-fail {
|
||||
color: #cc0000;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_contact {
|
||||
.swagger-section .swagger-ui-wrap .info_url {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_email {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_name {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.swagger-section .swagger-ui-wrap .info_description {
|
||||
|
||||
@@ -176,7 +176,15 @@
|
||||
color: #cc0000;
|
||||
}
|
||||
|
||||
.info_contact {
|
||||
.info_url {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info_email {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.info_name {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<div class="info_title">{{info.title}}</div>
|
||||
<div class="info_description markdown">{{{info.description}}}</div>
|
||||
{{#if info.termsOfServiceUrl}}<div class="info_tos"><a href="{{info.termsOfServiceUrl}}">Terms of service</a></div>{{/if}}
|
||||
{{#if info.contact.name}}<div class='info_contact'>Created by {{info.contact.name}}</div>{{/if}}
|
||||
{{#if info.contact.url}}<div class='info_contact'>See more at <a href="{{info.contact.url}}">{{info.contact.url}}</a></div>{{/if}}
|
||||
{{#if info.contact.email}}<div class='info_contact'><a href="mailto:{{info.contact.email}}?subject={{info.title}}">Contact the developer</a></div>{{/if}}
|
||||
{{#if info.contact.name}}<div class='info_name'>Created by {{info.contact.name}}</div>{{/if}}
|
||||
{{#if info.contact.url}}<div class='info_url'>See more at <a href="{{info.contact.url}}">{{info.contact.url}}</a></div>{{/if}}
|
||||
{{#if info.contact.email}}<div class='info_email'><a href="mailto:{{info.contact.email}}?subject={{info.title}}">Contact the developer</a></div>{{/if}}
|
||||
{{#if info.license}}<div class='info_license'><a href='{{info.license.url}}'>{{info.license.name}}</a></div>{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
var webdriver = require('selenium-webdriver');
|
||||
var createServer = require('http-server').createServer;
|
||||
var expect = require('chai').expect;
|
||||
var path = require('path')
|
||||
|
||||
var dist = path.join(__dirname, '..', '..', '..', 'dist');
|
||||
var PORT = 8080;
|
||||
|
||||
console.log('started static server from', dist, 'at port', PORT);
|
||||
|
||||
var server = createServer({
|
||||
root: dist,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(PORT);
|
||||
|
||||
var driver = new webdriver.Builder().
|
||||
withCapabilities(webdriver.Capabilities.firefox()).
|
||||
build();
|
||||
|
||||
|
||||
/*
|
||||
* Checks console errors and fails if there is any error
|
||||
* Note: It's a good idea to run this after each operation
|
||||
*/
|
||||
function checkConsoleErrors () {
|
||||
it('should not have any console errors', function (done) {
|
||||
driver.manage().logs().get('browser').then(function(browserLogs) {
|
||||
var errors = [];
|
||||
|
||||
browserLogs.forEach(function(log){
|
||||
|
||||
// 900 and above is "error" level. Console should not have any errors
|
||||
if (log.level.value > 900) {
|
||||
console.log('browser error message:', log.message);
|
||||
errors.push(log);
|
||||
}
|
||||
});
|
||||
|
||||
expect(errors).to.be.empty;
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
describe('basics', function (done) {
|
||||
this.timeout(10 * 1000);
|
||||
|
||||
beforeEach(function () {
|
||||
driver.get('http://localhost:' + PORT + '/index.html');
|
||||
});
|
||||
|
||||
it('should have "Swagger UI" in title', function (done) {
|
||||
driver.sleep(200);
|
||||
driver.getTitle().then(function(title) {
|
||||
expect(title).to.contain('Swagger UI');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
checkConsoleErrors();
|
||||
});
|
||||
|
||||
|
||||
describe('should render key elements in document', function () {
|
||||
var elementQueries = [
|
||||
'swagger-ui-container',
|
||||
'resources_container',
|
||||
'api_info',
|
||||
'resource_pet',
|
||||
'resource_store',
|
||||
'resource_user',
|
||||
'header'
|
||||
];
|
||||
|
||||
this.timeout(10000);
|
||||
|
||||
elementQueries.forEach(function (id) {
|
||||
|
||||
it('should render element: ' + id, function (done) {
|
||||
|
||||
var locator = webdriver.By.id(id)
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('cleanup', function () {
|
||||
it('kills the static server', function () {
|
||||
server.close();
|
||||
});
|
||||
|
||||
it('quit the webdriver', function () {
|
||||
driver.quit();
|
||||
});
|
||||
})
|
||||
125
test/e2e/v1.js
Normal file
125
test/e2e/v1.js
Normal file
@@ -0,0 +1,125 @@
|
||||
var webdriver = require('selenium-webdriver');
|
||||
var createServer = require('http-server').createServer;
|
||||
var expect = require('chai').expect;
|
||||
var path = require('path')
|
||||
|
||||
var dist = path.join(__dirname, '..', '..', 'dist');
|
||||
var specs = path.join(__dirname, '..', '..', 'test', 'specs');
|
||||
var DOCS_PORT = 8080;
|
||||
var SPEC_SERVER_PORT = 8081
|
||||
|
||||
var headers = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
|
||||
};
|
||||
|
||||
var elements = [
|
||||
'swagger-ui-container',
|
||||
'resources_container',
|
||||
'api_info',
|
||||
'resource_pet',
|
||||
'resource_store',
|
||||
'resource_user',
|
||||
'header'
|
||||
];
|
||||
|
||||
describe('swagger 1.x spec tests', function (done) {
|
||||
this.timeout(10 * 10000);
|
||||
var swaggerUI, specServer, driver;
|
||||
|
||||
before(function () {
|
||||
swaggerUI = createServer({
|
||||
root: dist,
|
||||
headers: headers
|
||||
});
|
||||
|
||||
specServer = createServer({
|
||||
root: specs,
|
||||
headers: headers
|
||||
});
|
||||
|
||||
swaggerUI.listen(DOCS_PORT);
|
||||
specServer.listen(SPEC_SERVER_PORT);
|
||||
|
||||
driver = new webdriver.Builder().
|
||||
withCapabilities(webdriver.Capabilities.firefox()).
|
||||
build();
|
||||
|
||||
var encoded = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + '/v1.2/petstore/api-docs')
|
||||
driver.get('http://localhost:' + DOCS_PORT + '/index.html?url=' + encoded);
|
||||
});
|
||||
|
||||
afterEach(function(){
|
||||
it('should not have any console errors', function (done) {
|
||||
driver.manage().logs().get('browser').then(function(browserLogs) {
|
||||
var errors = [];
|
||||
browserLogs.forEach(function(log){
|
||||
// 900 and above is "error" level. Console should not have any errors
|
||||
if (log.level.value > 900) {
|
||||
console.log('browser error message:', log.message);
|
||||
errors.push(log);
|
||||
}
|
||||
});
|
||||
|
||||
expect(errors).to.be.empty;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should have "Swagger UI" in title', function (done) {
|
||||
driver.sleep(200);
|
||||
driver.getTitle().then(function(title) {
|
||||
expect(title).to.contain('Swagger UI');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
elements.forEach(function (id) {
|
||||
it('should render element: ' + id, function (done) {
|
||||
var locator = webdriver.By.id(id)
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the contact name element', function(done){
|
||||
var locator = webdriver.By.css('.info_name');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the pet link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='pet']");
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the user link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='user']");
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the store link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='store']");
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
after(function() {
|
||||
swaggerUI.close();
|
||||
specServer.close();
|
||||
driver.quit();
|
||||
});
|
||||
});
|
||||
141
test/e2e/v2.js
Normal file
141
test/e2e/v2.js
Normal file
@@ -0,0 +1,141 @@
|
||||
var webdriver = require('selenium-webdriver');
|
||||
var createServer = require('http-server').createServer;
|
||||
var expect = require('chai').expect;
|
||||
var path = require('path')
|
||||
|
||||
var dist = path.join(__dirname, '..', '..', 'dist');
|
||||
var specs = path.join(__dirname, '..', '..', 'test', 'specs');
|
||||
var DOCS_PORT = 8080;
|
||||
var SPEC_SERVER_PORT = 8081
|
||||
|
||||
var headers = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
|
||||
};
|
||||
|
||||
var elements = [
|
||||
'swagger-ui-container',
|
||||
'resources_container',
|
||||
'api_info',
|
||||
'resource_pet',
|
||||
'resource_store',
|
||||
'resource_user',
|
||||
'header'
|
||||
];
|
||||
|
||||
describe('swagger 2.0 spec tests', function (done) {
|
||||
this.timeout(10 * 1000);
|
||||
var swaggerUI, specServer, driver;
|
||||
|
||||
before(function () {
|
||||
swaggerUI = createServer({
|
||||
root: dist,
|
||||
headers: headers
|
||||
});
|
||||
|
||||
specServer = createServer({
|
||||
root: specs,
|
||||
headers: headers
|
||||
});
|
||||
|
||||
swaggerUI.listen(DOCS_PORT);
|
||||
specServer.listen(SPEC_SERVER_PORT);
|
||||
|
||||
driver = new webdriver.Builder().
|
||||
withCapabilities(webdriver.Capabilities.firefox()).
|
||||
build();
|
||||
|
||||
var encoded = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + '/v2/petstore.json')
|
||||
driver.get('http://localhost:' + DOCS_PORT + '/index.html?url=' + encoded);
|
||||
});
|
||||
|
||||
afterEach(function(){
|
||||
it('should not have any console errors', function (done) {
|
||||
driver.manage().logs().get('browser').then(function(browserLogs) {
|
||||
var errors = [];
|
||||
browserLogs.forEach(function(log){
|
||||
// 900 and above is "error" level. Console should not have any errors
|
||||
if (log.level.value > 900) {
|
||||
console.log('browser error message:', log.message);
|
||||
errors.push(log);
|
||||
}
|
||||
});
|
||||
|
||||
expect(errors).to.be.empty;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should have "Swagger UI" in title', function (done) {
|
||||
driver.sleep(200);
|
||||
driver.getTitle().then(function(title) {
|
||||
expect(title).to.contain('Swagger UI');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
elements.forEach(function (id) {
|
||||
it('should render element: ' + id, function (done) {
|
||||
var locator = webdriver.By.id(id);
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the contact name element', function(done){
|
||||
var locator = webdriver.By.css('.info_name');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the contact email element', function(done){
|
||||
var locator = webdriver.By.css('.info_email');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the contact url element', function(done){
|
||||
var locator = webdriver.By.css('.info_url');
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the pet link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='pet']");
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the user link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='user']");
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the store link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='store']");
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
expect(isPresent).to.be.true;
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
after(function() {
|
||||
swaggerUI.close();
|
||||
specServer.close();
|
||||
driver.quit();
|
||||
});
|
||||
});
|
||||
1
test/mocha.opts
Normal file
1
test/mocha.opts
Normal file
@@ -0,0 +1 @@
|
||||
--recursive
|
||||
60
test/specs/v1.2/petstore/api-docs
Normal file
60
test/specs/v1.2/petstore/api-docs
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"apiVersion": "1.0.0",
|
||||
"swaggerVersion": "1.2",
|
||||
"apis": [
|
||||
{
|
||||
"path": "http://localhost:8081/v1.2/petstore/pet",
|
||||
"description": "Operations about pets"
|
||||
},
|
||||
{
|
||||
"path": "http://localhost:8081/v1.2/petstore/user",
|
||||
"description": "Operations about user"
|
||||
},
|
||||
{
|
||||
"path": "http://localhost:8081/v1.2/petstore/store",
|
||||
"description": "Operations about store"
|
||||
}
|
||||
],
|
||||
"authorizations": {
|
||||
"oauth2": {
|
||||
"type": "oauth2",
|
||||
"scopes": [
|
||||
{
|
||||
"scope": "email",
|
||||
"description": "Access to your email address"
|
||||
},
|
||||
{
|
||||
"scope": "pets",
|
||||
"description": "Access to your pets"
|
||||
}
|
||||
],
|
||||
"grantTypes": {
|
||||
"implicit": {
|
||||
"loginEndpoint": {
|
||||
"url": "http://petstore.swagger.wordnik.com/oauth/dialog"
|
||||
},
|
||||
"tokenName": "access_token"
|
||||
},
|
||||
"authorization_code": {
|
||||
"tokenRequestEndpoint": {
|
||||
"url": "http://petstore.swagger.wordnik.com/oauth/requestToken",
|
||||
"clientIdName": "client_id",
|
||||
"clientSecretName": "client_secret"
|
||||
},
|
||||
"tokenEndpoint": {
|
||||
"url": "http://petstore.swagger.wordnik.com/oauth/token",
|
||||
"tokenName": "access_code"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"title": "Swagger Sample App",
|
||||
"description": "This is a sample server Petstore server. You can find out more about Swagger \n at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> or on irc.freenode.net, #swagger. For this sample,\n you can use the api key \"special-key\" to test the authorization filters",
|
||||
"termsOfServiceUrl": "http://helloreverb.com/terms/",
|
||||
"contact": "apiteam@wordnik.com",
|
||||
"license": "Apache 2.0",
|
||||
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
}
|
||||
}
|
||||
425
test/specs/v1.2/petstore/pet
Normal file
425
test/specs/v1.2/petstore/pet
Normal file
@@ -0,0 +1,425 @@
|
||||
{
|
||||
"apiVersion": "1.0.0",
|
||||
"swaggerVersion": "1.2",
|
||||
"basePath": "http://petstore.swagger.wordnik.com/api",
|
||||
"resourcePath": "/pet",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml",
|
||||
"text/plain",
|
||||
"text/html"
|
||||
],
|
||||
"apis": [
|
||||
{
|
||||
"path": "/pet/{petId}",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Find pet by ID",
|
||||
"notes": "Returns a pet based on ID",
|
||||
"type": "Pet",
|
||||
"nickname": "getPetById",
|
||||
"authorizations": {},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "petId",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"paramType": "path",
|
||||
"minimum": "1.0",
|
||||
"maximum": "100000.0"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid ID supplied"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"message": "Pet not found"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"method": "PATCH",
|
||||
"summary": "partial updates to a pet",
|
||||
"notes": "",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "Pet"
|
||||
},
|
||||
"nickname": "partialUpdate",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "petId",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "path"
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"description": "Pet object that needs to be added to the store",
|
||||
"required": true,
|
||||
"type": "Pet",
|
||||
"paramType": "body"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid tag value"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"method": "POST",
|
||||
"summary": "Updates a pet in the store with form data",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "updatePetWithForm",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "petId",
|
||||
"description": "ID of pet that needs to be updated",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "path"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"description": "Updated name of the pet",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"paramType": "form"
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"description": "Updated status of the pet",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"paramType": "form"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 405,
|
||||
"message": "Invalid input"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"method": "DELETE",
|
||||
"summary": "Deletes a pet",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "deletePet",
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "petId",
|
||||
"description": "Pet id to delete",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "path"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid pet value"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/pet",
|
||||
"operations": [
|
||||
{
|
||||
"method": "PUT",
|
||||
"summary": "Update an existing pet",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "updatePet",
|
||||
"authorizations": {},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"description": "Pet object that needs to be updated in the store",
|
||||
"required": true,
|
||||
"type": "Pet",
|
||||
"paramType": "body"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid ID supplied"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"message": "Pet not found"
|
||||
},
|
||||
{
|
||||
"code": 405,
|
||||
"message": "Validation exception"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"method": "POST",
|
||||
"summary": "Add a new pet to the store",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "addPet",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"description": "Pet object that needs to be added to the store",
|
||||
"required": true,
|
||||
"type": "Pet",
|
||||
"paramType": "body"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 405,
|
||||
"message": "Invalid input"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/pet/findByStatus",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Finds Pets by status",
|
||||
"notes": "Multiple status values can be provided with comma seperated strings",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "Pet"
|
||||
},
|
||||
"nickname": "findPetsByStatus",
|
||||
"authorizations": {},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "status",
|
||||
"description": "Status values that need to be considered for filter",
|
||||
"defaultValue": "available",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"enum": [
|
||||
"available",
|
||||
"pending",
|
||||
"sold"
|
||||
]
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid status value"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/pet/findByTags",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Finds Pets by tags",
|
||||
"notes": "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "Pet"
|
||||
},
|
||||
"nickname": "findPetsByTags",
|
||||
"authorizations": {},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "tags",
|
||||
"description": "Tags to filter by",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "query"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid tag value"
|
||||
}
|
||||
],
|
||||
"deprecated": "true"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/pet/uploadImage",
|
||||
"operations": [
|
||||
{
|
||||
"method": "POST",
|
||||
"summary": "uploads an image",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "uploadFile",
|
||||
"consumes": [
|
||||
"multipart/form-data"
|
||||
],
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
},
|
||||
{
|
||||
"scope": "test:nothing",
|
||||
"description": "nothing"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "additionalMetadata",
|
||||
"description": "Additional data to pass to server",
|
||||
"required": false,
|
||||
"type": "string",
|
||||
"paramType": "form"
|
||||
},
|
||||
{
|
||||
"name": "file",
|
||||
"description": "file to upload",
|
||||
"required": false,
|
||||
"type": "File",
|
||||
"paramType": "body"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"models": {
|
||||
"Tag": {
|
||||
"id": "Tag",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Pet": {
|
||||
"id": "Pet",
|
||||
"required": [
|
||||
"id",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "unique identifier for the pet",
|
||||
"minimum": "0.0",
|
||||
"maximum": "100.0"
|
||||
},
|
||||
"category": {
|
||||
"$ref": "Category"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"photoUrls": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "Tag"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"description": "pet status in the store",
|
||||
"enum": [
|
||||
"available",
|
||||
"pending",
|
||||
"sold"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"Category": {
|
||||
"id": "Category",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
145
test/specs/v1.2/petstore/store
Normal file
145
test/specs/v1.2/petstore/store
Normal file
@@ -0,0 +1,145 @@
|
||||
{
|
||||
"apiVersion": "1.0.0",
|
||||
"swaggerVersion": "1.2",
|
||||
"basePath": "http://petstore.swagger.wordnik.com/api",
|
||||
"resourcePath": "/store",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"apis": [
|
||||
{
|
||||
"path": "/store/order/{orderId}",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Find purchase order by ID",
|
||||
"notes": "For valid response try integer IDs with value <= 5. Anything above 5 or nonintegers will generate API errors",
|
||||
"type": "Order",
|
||||
"nickname": "getOrderById",
|
||||
"authorizations": {},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "orderId",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "path"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid ID supplied"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"message": "Order not found"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"method": "DELETE",
|
||||
"summary": "Delete purchase order by ID",
|
||||
"notes": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
|
||||
"type": "void",
|
||||
"nickname": "deleteOrder",
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "orderId",
|
||||
"description": "ID of the order that needs to be deleted",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "path"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid ID supplied"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"message": "Order not found"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/store/order",
|
||||
"operations": [
|
||||
{
|
||||
"method": "POST",
|
||||
"summary": "Place an order for a pet",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "placeOrder",
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"description": "order placed for purchasing the pet",
|
||||
"required": true,
|
||||
"type": "Order",
|
||||
"paramType": "body"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid order"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"models": {
|
||||
"Order": {
|
||||
"id": "Order",
|
||||
"description": "an order in the system",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"petId": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"quantity": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"description": "Order Status",
|
||||
"enum": [
|
||||
"placed",
|
||||
" approved",
|
||||
" delivered"
|
||||
]
|
||||
},
|
||||
"shipDate": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
299
test/specs/v1.2/petstore/user
Normal file
299
test/specs/v1.2/petstore/user
Normal file
@@ -0,0 +1,299 @@
|
||||
{
|
||||
"apiVersion": "1.0.0",
|
||||
"swaggerVersion": "1.2",
|
||||
"basePath": "http://petstore.swagger.wordnik.com/api",
|
||||
"resourcePath": "/user",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"apis": [
|
||||
{
|
||||
"path": "/user",
|
||||
"operations": [
|
||||
{
|
||||
"method": "POST",
|
||||
"summary": "Create user",
|
||||
"notes": "This can only be done by the logged in user.",
|
||||
"type": "void",
|
||||
"nickname": "createUser",
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"description": "Created user object",
|
||||
"required": true,
|
||||
"type": "User",
|
||||
"paramType": "body"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/user/logout",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Logs out current logged in user session",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "logoutUser",
|
||||
"authorizations": {},
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/user/createWithArray",
|
||||
"operations": [
|
||||
{
|
||||
"method": "POST",
|
||||
"summary": "Creates list of users with given input array",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "createUsersWithArrayInput",
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"description": "List of user object",
|
||||
"required": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "User"
|
||||
},
|
||||
"paramType": "body"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/user/createWithList",
|
||||
"operations": [
|
||||
{
|
||||
"method": "POST",
|
||||
"summary": "Creates list of users with given list input",
|
||||
"notes": "",
|
||||
"type": "void",
|
||||
"nickname": "createUsersWithListInput",
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"description": "List of user object",
|
||||
"required": true,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "User"
|
||||
},
|
||||
"paramType": "body"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/user/{username}",
|
||||
"operations": [
|
||||
{
|
||||
"method": "PUT",
|
||||
"summary": "Updated user",
|
||||
"notes": "This can only be done by the logged in user.",
|
||||
"type": "void",
|
||||
"nickname": "updateUser",
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "username",
|
||||
"description": "name that need to be deleted",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "path"
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"description": "Updated user object",
|
||||
"required": true,
|
||||
"type": "User",
|
||||
"paramType": "body"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid username supplied"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"message": "User not found"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"method": "DELETE",
|
||||
"summary": "Delete user",
|
||||
"notes": "This can only be done by the logged in user.",
|
||||
"type": "void",
|
||||
"nickname": "deleteUser",
|
||||
"authorizations": {
|
||||
"oauth2": [
|
||||
{
|
||||
"scope": "test:anything",
|
||||
"description": "anything"
|
||||
}
|
||||
]
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "username",
|
||||
"description": "The name that needs to be deleted",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "path"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid username supplied"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"message": "User not found"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Get user by user name",
|
||||
"notes": "",
|
||||
"type": "User",
|
||||
"nickname": "getUserByName",
|
||||
"authorizations": {},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "username",
|
||||
"description": "The name that needs to be fetched. Use user1 for testing.",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "path"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid username supplied"
|
||||
},
|
||||
{
|
||||
"code": 404,
|
||||
"message": "User not found"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/user/login",
|
||||
"operations": [
|
||||
{
|
||||
"method": "GET",
|
||||
"summary": "Logs user into the system",
|
||||
"notes": "",
|
||||
"type": "string",
|
||||
"nickname": "loginUser",
|
||||
"authorizations": {},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "username",
|
||||
"description": "The user name for login",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "query"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"description": "The password for login in clear text",
|
||||
"required": true,
|
||||
"type": "string",
|
||||
"paramType": "query"
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 400,
|
||||
"message": "Invalid username and password combination"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"models": {
|
||||
"User": {
|
||||
"id": "User",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"firstName": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
},
|
||||
"lastName": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
},
|
||||
"userStatus": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "User Status",
|
||||
"enum": [
|
||||
"1-registered",
|
||||
"2-active",
|
||||
"3-closed"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
930
test/specs/v2/petstore.json
Normal file
930
test/specs/v2/petstore.json
Normal file
@@ -0,0 +1,930 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
|
||||
"version": "1.0.0",
|
||||
"title": "Swagger Petstore",
|
||||
"termsOfService": "http://helloreverb.com/terms/",
|
||||
"contact": {
|
||||
"url": "http://swagger.io",
|
||||
"name": "Your pals at Swagger",
|
||||
"email": "apiteam@wordnik.com"
|
||||
},
|
||||
"license": {
|
||||
"name": "Apache 2.0",
|
||||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
}
|
||||
},
|
||||
"host": "petstore.swagger.wordnik.com",
|
||||
"basePath": "/v2",
|
||||
"schemes": [
|
||||
"http"
|
||||
],
|
||||
"paths": {
|
||||
"/pet": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"summary": "Add a new pet to the store",
|
||||
"description": "",
|
||||
"operationId": "addPet",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "pet",
|
||||
"description": "Pet object that needs to be added to the store",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Pet"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"405": {
|
||||
"description": "Invalid input"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"summary": "Update an existing pet",
|
||||
"description": "",
|
||||
"operationId": "updatePet",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"description": "Pet object that needs to be added to the store",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Pet"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"405": {
|
||||
"description": "Validation exception"
|
||||
},
|
||||
"404": {
|
||||
"description": "Pet not found"
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid ID supplied"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pet/findByStatus": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"summary": "Finds Pets by status",
|
||||
"description": "Multiple status values can be provided with comma seperated strings",
|
||||
"operationId": "findPetsByStatus",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "query",
|
||||
"name": "status",
|
||||
"description": "Status values that need to be considered for filter",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"collectionFormat": "multi"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid status value"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pet/findByTags": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"summary": "Finds Pets by tags",
|
||||
"description": "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
|
||||
"operationId": "findPetsByTags",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "query",
|
||||
"name": "tags",
|
||||
"description": "Tags to filter by",
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"collectionFormat": "multi"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Pet"
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid tag value"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/pet/{petId}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"summary": "Find pet by ID",
|
||||
"description": "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
|
||||
"operationId": "getPetById",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "petId",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"404": {
|
||||
"description": "Pet not found"
|
||||
},
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Pet"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid ID supplied"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"api_key": []
|
||||
},
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"summary": "Updates a pet in the store with form data",
|
||||
"description": "",
|
||||
"operationId": "updatePetWithForm",
|
||||
"consumes": [
|
||||
"application/x-www-form-urlencoded"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "petId",
|
||||
"description": "ID of pet that needs to be updated",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"in": "formData",
|
||||
"name": "name",
|
||||
"description": "Updated name of the pet",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"in": "formData",
|
||||
"name": "status",
|
||||
"description": "Updated status of the pet",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"405": {
|
||||
"description": "Invalid input"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"pet"
|
||||
],
|
||||
"summary": "Deletes a pet",
|
||||
"description": "",
|
||||
"operationId": "deletePet",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "header",
|
||||
"name": "api_key",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"in": "path",
|
||||
"name": "petId",
|
||||
"description": "Pet id to delete",
|
||||
"required": true,
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"400": {
|
||||
"description": "Invalid pet value"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"petstore_auth": [
|
||||
"write:pets",
|
||||
"read:pets"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/store/order": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"store"
|
||||
],
|
||||
"summary": "Place an order for a pet",
|
||||
"description": "",
|
||||
"operationId": "placeOrder",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"description": "order placed for purchasing the pet",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Order"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Order"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid Order"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/store/order/{orderId}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"store"
|
||||
],
|
||||
"summary": "Find purchase order by ID",
|
||||
"description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
|
||||
"operationId": "getOrderById",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "orderId",
|
||||
"description": "ID of pet that needs to be fetched",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"404": {
|
||||
"description": "Order not found"
|
||||
},
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Order"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid ID supplied"
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"store"
|
||||
],
|
||||
"summary": "Delete purchase order by ID",
|
||||
"description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
|
||||
"operationId": "deleteOrder",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "orderId",
|
||||
"description": "ID of the order that needs to be deleted",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"404": {
|
||||
"description": "Order not found"
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid ID supplied"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Create user",
|
||||
"description": "This can only be done by the logged in user.",
|
||||
"operationId": "createUser",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"description": "Created user object",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/User"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "successful operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/createWithArray": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Creates list of users with given input array",
|
||||
"description": "",
|
||||
"operationId": "createUsersWithArrayInput",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"description": "List of user object",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "User"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "successful operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/createWithList": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Creates list of users with given input array",
|
||||
"description": "",
|
||||
"operationId": "createUsersWithListInput",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"description": "List of user object",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/User"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "successful operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/login": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Logs user into the system",
|
||||
"description": "",
|
||||
"operationId": "loginUser",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "query",
|
||||
"name": "username",
|
||||
"description": "The user name for login",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "password",
|
||||
"description": "The password for login in clear text",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid username/password supplied"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/logout": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Logs out current logged in user session",
|
||||
"description": "",
|
||||
"operationId": "logoutUser",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "successful operation"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/{username}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Get user by user name",
|
||||
"description": "",
|
||||
"operationId": "getUserByName",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "username",
|
||||
"description": "The name that needs to be fetched. Use user1 for testing. ",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"404": {
|
||||
"description": "User not found"
|
||||
},
|
||||
"200": {
|
||||
"description": "successful operation",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/User"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid username supplied"
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Updated user",
|
||||
"description": "This can only be done by the logged in user.",
|
||||
"operationId": "updateUser",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "username",
|
||||
"description": "name that need to be deleted",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"in": "body",
|
||||
"name": "body",
|
||||
"description": "Updated user object",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/User"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"404": {
|
||||
"description": "User not found"
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid user supplied"
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Delete user",
|
||||
"description": "This can only be done by the logged in user.",
|
||||
"operationId": "deleteUser",
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/xml"
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "username",
|
||||
"description": "The name that needs to be deleted",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"404": {
|
||||
"description": "User not found"
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid username supplied"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"api_key": {
|
||||
"type": "apiKey",
|
||||
"name": "api_key",
|
||||
"in": "header"
|
||||
},
|
||||
"petstore_auth": {
|
||||
"type": "oauth2",
|
||||
"authorizationUrl": "http://petstore.swagger.wordnik.com/api/oauth/dialog",
|
||||
"flow": "implicit"
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"User": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"xml": {
|
||||
"name": "id"
|
||||
}
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "username"
|
||||
}
|
||||
},
|
||||
"firstName": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "firstName"
|
||||
}
|
||||
},
|
||||
"lastName": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "lastName"
|
||||
}
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "email"
|
||||
}
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "password"
|
||||
}
|
||||
},
|
||||
"phone": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "phone"
|
||||
}
|
||||
},
|
||||
"userStatus": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"xml": {
|
||||
"name": "userStatus"
|
||||
},
|
||||
"description": "User Status"
|
||||
}
|
||||
},
|
||||
"xml": {
|
||||
"name": "User"
|
||||
}
|
||||
},
|
||||
"Category": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"xml": {
|
||||
"name": "id"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "name"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xml": {
|
||||
"name": "Category"
|
||||
}
|
||||
},
|
||||
"Pet": {
|
||||
"required": [
|
||||
"name",
|
||||
"photoUrls"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"xml": {
|
||||
"name": "id"
|
||||
}
|
||||
},
|
||||
"category": {
|
||||
"xml": {
|
||||
"name": "category"
|
||||
},
|
||||
"$ref": "Category"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "doggie",
|
||||
"xml": {
|
||||
"name": "name"
|
||||
}
|
||||
},
|
||||
"photoUrls": {
|
||||
"type": "array",
|
||||
"xml": {
|
||||
"name": "photoUrl",
|
||||
"wrapped": true
|
||||
},
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"xml": {
|
||||
"name": "tag",
|
||||
"wrapped": true
|
||||
},
|
||||
"items": {
|
||||
"$ref": "Tag"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "status"
|
||||
},
|
||||
"description": "pet status in the store"
|
||||
}
|
||||
},
|
||||
"xml": {
|
||||
"name": "Pet"
|
||||
}
|
||||
},
|
||||
"Tag": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"xml": {
|
||||
"name": "id"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "name"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xml": {
|
||||
"name": "Tag"
|
||||
}
|
||||
},
|
||||
"Order": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"xml": {
|
||||
"name": "id"
|
||||
}
|
||||
},
|
||||
"petId": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"xml": {
|
||||
"name": "petId"
|
||||
}
|
||||
},
|
||||
"quantity": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"xml": {
|
||||
"name": "quantity"
|
||||
}
|
||||
},
|
||||
"shipDate": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"xml": {
|
||||
"name": "shipDate"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"xml": {
|
||||
"name": "status"
|
||||
},
|
||||
"description": "Order Status"
|
||||
},
|
||||
"complete": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"xml": {
|
||||
"name": "Order"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user