diff --git a/dist/css/screen.css b/dist/css/screen.css index 478b9983..a9328150 100644 --- a/dist/css/screen.css +++ b/dist/css/screen.css @@ -1100,6 +1100,85 @@ .swagger-section .api-popup-actions { 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 { float: right; } diff --git a/dist/lib/swagger-client.js b/dist/lib/swagger-client.js index f896bc33..09898ab9 100644 --- a/dist/lib/swagger-client.js +++ b/dist/lib/swagger-client.js @@ -420,6 +420,9 @@ SwaggerClient.prototype.buildFromSpec = function(response) { if(typeof response.paths[path] === 'object') { var httpMethod; 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 tags = operation.tags; if(typeof tags === 'undefined') { @@ -556,7 +559,7 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition param.allowMultiple = true; } var innerType = this.getType(param); - if(innerType.toString().toLowerCase() === 'boolean') { + if(innerType && innerType.toString().toLowerCase() === 'boolean') { param.allowableValues = {}; param.isList = true; param.enum = ["true", "false"]; diff --git a/dist/lib/swagger.js b/dist/lib/swagger.js index 20b5ed2b..6382a5d1 100644 --- a/dist/lib/swagger.js +++ b/dist/lib/swagger.js @@ -498,7 +498,7 @@ } } 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; output.push(this.operationsArray.push(op)); } @@ -691,7 +691,7 @@ 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 errors = []; @@ -707,6 +707,7 @@ this.consumes = consumes; this.produces = produces; this.authorizations = authorizations; + this.deprecated = deprecated; this["do"] = __bind(this["do"], this); if (errors.length > 0) { @@ -738,7 +739,7 @@ } param.type = type; - if (type.toLowerCase() === 'boolean') { + if (type && type.toLowerCase() === 'boolean') { param.allowableValues = {}; param.allowableValues.values = ["true", "false"]; } @@ -975,22 +976,9 @@ var param = params[i]; if (param.paramType === 'query') { if (args[param.name] !== undefined) { - var value = args[param.name]; 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 cookies = {}; + e.parameterMacro = parameterMacro; + e.modelPropertyMacro = modelPropertyMacro; e.SampleModels = sampleModels; e.SwaggerHttp = SwaggerHttp; e.SwaggerRequest = SwaggerRequest; diff --git a/lib/swagger-client.js b/lib/swagger-client.js index f1e3bfde..09898ab9 100644 --- a/lib/swagger-client.js +++ b/lib/swagger-client.js @@ -559,7 +559,7 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition param.allowMultiple = true; } var innerType = this.getType(param); - if(innerType.toString().toLowerCase() === 'boolean') { + if(innerType && innerType.toString().toLowerCase() === 'boolean') { param.allowableValues = {}; param.isList = true; 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) { return escape(arg); @@ -1040,7 +1040,7 @@ var Model = function(name, definition) { if(requiredFields.indexOf(key) >= 0) required = true; this.properties.push(new Property(key, property, required)); - } + } } } @@ -1219,7 +1219,7 @@ Property.prototype.toString = function() { str += ', optional'; str += ')'; } - else + else str = this.name + ' (' + JSON.stringify(this.obj) + ')'; if(typeof this.description !== 'undefined') @@ -1483,4 +1483,4 @@ ShredHttpClient.prototype.execute = function(obj) { obj.on = res; } return this.shred.request(obj); -}; +}; \ No newline at end of file diff --git a/lib/swagger.js b/lib/swagger.js index 6382a5d1..0c63a38b 100644 --- a/lib/swagger.js +++ b/lib/swagger.js @@ -1,5 +1,5 @@ // swagger.js -// version 2.0.41 +// version 2.0.42 (function () { @@ -974,16 +974,22 @@ var queryParams = ""; for (var i = 0; i < params.length; 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; }; @@ -1477,8 +1483,8 @@ 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.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) { if (response.content.data && response.content.data !== "")