@@ -1100,6 +1100,85 @@ | |||||
.swagger-section .api-popup-actions { | .swagger-section .api-popup-actions { | ||||
padding-top: 10px; | padding-top: 10px; | ||||
} | } | ||||
.auth { | |||||
text-align: right; | |||||
height: 15px; | |||||
float: right; | |||||
clear: both; | |||||
display: inline-block; | |||||
position: relative; | |||||
z-index: 3; | |||||
} | |||||
.auth_icon { | |||||
float: right; | |||||
} | |||||
.auth_container_2 { | |||||
visibility: visible; | |||||
position: absolute; | |||||
width: 250px; | |||||
margin-top: 26px; | |||||
float: left; | |||||
display: none; | |||||
border: solid 2px; | |||||
background: white; | |||||
-moz-border-radius: 4px; | |||||
-webkit-border-radius: 4px; | |||||
-o-border-radius: 4px; | |||||
-ms-border-radius: 4px; | |||||
-khtml-border-radius: 4px; | |||||
z-index: 2; | |||||
} | |||||
.auth_label { | |||||
text-align: left; | |||||
clear: left; | |||||
float: left; | |||||
padding-left: 10px; | |||||
width: 90px; | |||||
} | |||||
.auth_submit { | |||||
border-left: 1px; | |||||
border-right: 1px; | |||||
margin-top: 25px; | |||||
margin-bottom: 25px; | |||||
text-align: center; | |||||
} | |||||
.auth_button { | |||||
display: block; | |||||
float: right; | |||||
text-align: right; | |||||
} | |||||
.auth_submit_button { | |||||
display: block; | |||||
text-decoration: none; | |||||
font-weight: bold; | |||||
padding: 6px 8px; | |||||
font-size: 0.9em; | |||||
color: white; | |||||
float: right; | |||||
text-align: center; | |||||
background: #547f00; | |||||
-moz-border-radius: 4px; | |||||
-webkit-border-radius: 4px; | |||||
-o-border-radius: 4px; | |||||
-ms-border-radius: 4px; | |||||
-khtml-border-radius: 4px; | |||||
margin-top: 10px; | |||||
margin-bottom: 10px; | |||||
margin-right: 10px; | |||||
} | |||||
.auth_input { | |||||
float: left; | |||||
} | |||||
.authentication_container { | |||||
float: left; | |||||
display: block; | |||||
background: yellow; | |||||
} | |||||
.auth_button .auth_icon { | |||||
width: 25px; | |||||
height: 25px; | |||||
cursor: pointer; | |||||
} | |||||
.swagger-section .access { | .swagger-section .access { | ||||
float: right; | float: right; | ||||
} | } | ||||
@@ -420,6 +420,9 @@ SwaggerClient.prototype.buildFromSpec = function(response) { | |||||
if(typeof response.paths[path] === 'object') { | if(typeof response.paths[path] === 'object') { | ||||
var httpMethod; | var httpMethod; | ||||
for(httpMethod in response.paths[path]) { | for(httpMethod in response.paths[path]) { | ||||
if(['delete', 'get', 'head', 'options', 'patch', 'post', 'put'].indexOf(httpMethod) === -1) { | |||||
continue; | |||||
} | |||||
var operation = response.paths[path][httpMethod]; | var operation = response.paths[path][httpMethod]; | ||||
var tags = operation.tags; | var tags = operation.tags; | ||||
if(typeof tags === 'undefined') { | if(typeof tags === 'undefined') { | ||||
@@ -556,7 +559,7 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition | |||||
param.allowMultiple = true; | param.allowMultiple = true; | ||||
} | } | ||||
var innerType = this.getType(param); | var innerType = this.getType(param); | ||||
if(innerType.toString().toLowerCase() === 'boolean') { | |||||
if(innerType && innerType.toString().toLowerCase() === 'boolean') { | |||||
param.allowableValues = {}; | param.allowableValues = {}; | ||||
param.isList = true; | param.isList = true; | ||||
param.enum = ["true", "false"]; | param.enum = ["true", "false"]; | ||||
@@ -498,7 +498,7 @@ | |||||
} | } | ||||
} | } | ||||
o.nickname = this.sanitize(o.nickname); | o.nickname = this.sanitize(o.nickname); | ||||
var op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces, o.authorizations); | |||||
var op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces, o.authorizations, o.deprecated); | |||||
this.operations[op.nickname] = op; | this.operations[op.nickname] = op; | ||||
output.push(this.operationsArray.push(op)); | output.push(this.operationsArray.push(op)); | ||||
} | } | ||||
@@ -691,7 +691,7 @@ | |||||
return str; | return str; | ||||
}; | }; | ||||
var SwaggerOperation = function (nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) { | |||||
var SwaggerOperation = function (nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations, deprecated) { | |||||
var _this = this; | var _this = this; | ||||
var errors = []; | var errors = []; | ||||
@@ -707,6 +707,7 @@ | |||||
this.consumes = consumes; | this.consumes = consumes; | ||||
this.produces = produces; | this.produces = produces; | ||||
this.authorizations = authorizations; | this.authorizations = authorizations; | ||||
this.deprecated = deprecated; | |||||
this["do"] = __bind(this["do"], this); | this["do"] = __bind(this["do"], this); | ||||
if (errors.length > 0) { | if (errors.length > 0) { | ||||
@@ -738,7 +739,7 @@ | |||||
} | } | ||||
param.type = type; | param.type = type; | ||||
if (type.toLowerCase() === 'boolean') { | |||||
if (type && type.toLowerCase() === 'boolean') { | |||||
param.allowableValues = {}; | param.allowableValues = {}; | ||||
param.allowableValues.values = ["true", "false"]; | param.allowableValues.values = ["true", "false"]; | ||||
} | } | ||||
@@ -975,22 +976,9 @@ | |||||
var param = params[i]; | var param = params[i]; | ||||
if (param.paramType === 'query') { | if (param.paramType === 'query') { | ||||
if (args[param.name] !== undefined) { | if (args[param.name] !== undefined) { | ||||
var value = args[param.name]; | |||||
if (queryParams !== '') | if (queryParams !== '') | ||||
queryParams += '&'; | |||||
if (Array.isArray(value)) { | |||||
var j; | |||||
var output = ''; | |||||
for(j = 0; j < value.length; j++) { | |||||
if(j > 0) | |||||
output += ','; | |||||
output += encodeURIComponent(value[j]); | |||||
} | |||||
queryParams += encodeURIComponent(param.name) + '=' + output; | |||||
} | |||||
else { | |||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | |||||
} | |||||
queryParams += "&"; | |||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1659,6 +1647,8 @@ | |||||
var sampleModels = {}; | var sampleModels = {}; | ||||
var cookies = {}; | var cookies = {}; | ||||
e.parameterMacro = parameterMacro; | |||||
e.modelPropertyMacro = modelPropertyMacro; | |||||
e.SampleModels = sampleModels; | e.SampleModels = sampleModels; | ||||
e.SwaggerHttp = SwaggerHttp; | e.SwaggerHttp = SwaggerHttp; | ||||
e.SwaggerRequest = SwaggerRequest; | e.SwaggerRequest = SwaggerRequest; | ||||
@@ -559,7 +559,7 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition | |||||
param.allowMultiple = true; | param.allowMultiple = true; | ||||
} | } | ||||
var innerType = this.getType(param); | var innerType = this.getType(param); | ||||
if(innerType.toString().toLowerCase() === 'boolean') { | |||||
if(innerType && innerType.toString().toLowerCase() === 'boolean') { | |||||
param.allowableValues = {}; | param.allowableValues = {}; | ||||
param.isList = true; | param.isList = true; | ||||
param.enum = ["true", "false"]; | param.enum = ["true", "false"]; | ||||
@@ -1000,7 +1000,7 @@ Operation.prototype.encodeCollection = function(type, name, value) { | |||||
} | } | ||||
/** | /** | ||||
* TODO this encoding needs to be changed | |||||
* TODO this encoding needs to be changed | |||||
**/ | **/ | ||||
Operation.prototype.encodeQueryParam = function(arg) { | Operation.prototype.encodeQueryParam = function(arg) { | ||||
return escape(arg); | return escape(arg); | ||||
@@ -1040,7 +1040,7 @@ var Model = function(name, definition) { | |||||
if(requiredFields.indexOf(key) >= 0) | if(requiredFields.indexOf(key) >= 0) | ||||
required = true; | required = true; | ||||
this.properties.push(new Property(key, property, required)); | this.properties.push(new Property(key, property, required)); | ||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -1219,7 +1219,7 @@ Property.prototype.toString = function() { | |||||
str += ', <span class="propOptKey">optional</span>'; | str += ', <span class="propOptKey">optional</span>'; | ||||
str += ')'; | str += ')'; | ||||
} | } | ||||
else | |||||
else | |||||
str = this.name + ' (' + JSON.stringify(this.obj) + ')'; | str = this.name + ' (' + JSON.stringify(this.obj) + ')'; | ||||
if(typeof this.description !== 'undefined') | if(typeof this.description !== 'undefined') | ||||
@@ -1483,4 +1483,4 @@ ShredHttpClient.prototype.execute = function(obj) { | |||||
obj.on = res; | obj.on = res; | ||||
} | } | ||||
return this.shred.request(obj); | return this.shred.request(obj); | ||||
}; | |||||
}; |
@@ -1,5 +1,5 @@ | |||||
// swagger.js | // swagger.js | ||||
// version 2.0.41 | |||||
// version 2.0.42 | |||||
(function () { | (function () { | ||||
@@ -974,16 +974,22 @@ | |||||
var queryParams = ""; | var queryParams = ""; | ||||
for (var i = 0; i < params.length; i++) { | for (var i = 0; i < params.length; i++) { | ||||
var param = params[i]; | var param = params[i]; | ||||
if (param.paramType === 'query') { | |||||
if (args[param.name] !== undefined) { | |||||
if (queryParams !== '') | |||||
queryParams += "&"; | |||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | |||||
} | |||||
if (queryParams !== '') | |||||
queryParams += '&'; | |||||
if (Array.isArray(param)) { | |||||
var j; | |||||
var output = ''; | |||||
for(j = 0; j < param.length; j++) { | |||||
if(j > 0) | |||||
output += ','; | |||||
output += encodeURIComponent(param[j]); | |||||
} | |||||
queryParams += encodeURIComponent(param.name) + '=' + output; | |||||
} | |||||
else { | |||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | |||||
} | } | ||||
} | } | ||||
if ((queryParams != null) && queryParams.length > 0) | |||||
url += '?' + queryParams; | |||||
return url; | return url; | ||||
}; | }; | ||||
@@ -1477,8 +1483,8 @@ | |||||
data: response.content.data | data: response.content.data | ||||
}; | }; | ||||
var contentType = (response._headers["content-type"] || response._headers["Content-Type"] || null) | |||||
var headers = response._headers.normalized || response._headers; | |||||
var contentType = (headers["content-type"] || headers["Content-Type"] || null) | |||||
if (contentType != null) { | if (contentType != null) { | ||||
if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { | ||||
if (response.content.data && response.content.data !== "") | if (response.content.data && response.content.data !== "") | ||||