@@ -513,7 +513,11 @@ SwaggerClient.prototype.idFromOp = function(path, httpMethod, op) { | |||||
return (op.operationId); | return (op.operationId); | ||||
} | } | ||||
else { | else { | ||||
return path.substring(1).replace(/\//g, "_").replace(/\{/g, "").replace(/\}/g, "") + "_" + httpMethod; | |||||
return path.substring(1) | |||||
.replace(/\//g, "_") | |||||
.replace(/\{/g, "") | |||||
.replace(/\}/g, "") | |||||
.replace(/\./g, "_") + "_" + httpMethod; | |||||
} | } | ||||
} | } | ||||
@@ -658,8 +662,8 @@ Operation.prototype.getType = function (param) { | |||||
str = 'integer'; | str = 'integer'; | ||||
else if(type === 'integer' && format === 'int64') | else if(type === 'integer' && format === 'int64') | ||||
str = 'long'; | str = 'long'; | ||||
else if(type === 'integer' && typeof format === 'undefined') | |||||
str = 'long'; | |||||
else if(type === 'integer') | |||||
str = 'integer' | |||||
else if(type === 'string' && format === 'date-time') | else if(type === 'string' && format === 'date-time') | ||||
str = 'date-time'; | str = 'date-time'; | ||||
else if(type === 'string' && format === 'date') | else if(type === 'string' && format === 'date') | ||||
@@ -668,7 +672,7 @@ Operation.prototype.getType = function (param) { | |||||
str = 'float'; | str = 'float'; | ||||
else if(type === 'number' && format === 'double') | else if(type === 'number' && format === 'double') | ||||
str = 'double'; | str = 'double'; | ||||
else if(type === 'number' && typeof format === 'undefined') | |||||
else if(type === 'number') | |||||
str = 'double'; | str = 'double'; | ||||
else if(type === 'boolean') | else if(type === 'boolean') | ||||
str = 'boolean'; | str = 'boolean'; | ||||
@@ -878,7 +882,12 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) { | |||||
// todo append? | // todo append? | ||||
args.body = encoded; | args.body = encoded; | ||||
} | } | ||||
var url = this.scheme + '://' + this.host + this.basePath + requestUrl + querystring; | |||||
var url = this.scheme + '://' + this.host; | |||||
if(this.basePath !== '/') | |||||
url += this.basePath; | |||||
url += requestUrl + querystring; | |||||
var obj = { | var obj = { | ||||
url: url, | url: url, | ||||
@@ -1,5 +1,5 @@ | |||||
// swagger.js | // swagger.js | ||||
// version 2.0.46 | |||||
// version 2.0.47 | |||||
(function () { | (function () { | ||||
@@ -992,9 +992,14 @@ | |||||
output += encodeURIComponent(param[j]); | output += encodeURIComponent(param[j]); | ||||
} | } | ||||
queryParams += encodeURIComponent(param.name) + '=' + output; | queryParams += encodeURIComponent(param.name) + '=' + output; | ||||
} | |||||
else { | |||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | |||||
} | |||||
else { | |||||
if (args[param.name]) { | |||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | |||||
} else { | |||||
if (param.required) | |||||
throw "" + param.name + " is a required query param."; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1275,7 +1280,7 @@ | |||||
else if (this.type === "DELETE") | else if (this.type === "DELETE") | ||||
body = "{}"; | body = "{}"; | ||||
else if (this.type != "DELETE") | else if (this.type != "DELETE") | ||||
accepts = null; | |||||
consumes = null; | |||||
} | } | ||||
if (consumes && this.operation.consumes) { | if (consumes && this.operation.consumes) { | ||||
@@ -990,7 +990,7 @@ function program4(depth0,data) { | |||||
function program5(depth0,data) { | function program5(depth0,data) { | ||||
var buffer = "", stack1; | var buffer = "", stack1; | ||||
buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='"; | |||||
buffer += "\n <textarea class='body-textarea required' placeholder='(required)' name='"; | |||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } | if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } | ||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } | else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } | ||||
buffer += escapeExpression(stack1) | buffer += escapeExpression(stack1) | ||||
@@ -1005,7 +1005,7 @@ function program5(depth0,data) { | |||||
function program7(depth0,data) { | function program7(depth0,data) { | ||||
var buffer = "", stack1; | var buffer = "", stack1; | ||||
buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='"; | |||||
buffer += "\n <textarea class='body-textarea required' placeholder='(required)' name='"; | |||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } | if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } | ||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } | else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } | ||||
buffer += escapeExpression(stack1) | buffer += escapeExpression(stack1) | ||||
@@ -1949,6 +1949,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; | |||||
return error_free = false; | return error_free = false; | ||||
} | } | ||||
}); | }); | ||||
form.find("textarea.required").each(function() { | |||||
var _this = this; | |||||
$(this).removeClass("error"); | |||||
if (jQuery.trim($(this).val()) === "") { | |||||
$(this).addClass("error"); | |||||
$(this).wiggle({ | |||||
callback: function() { | |||||
return $(_this).focus(); | |||||
} | |||||
}); | |||||
return error_free = false; | |||||
} | |||||
}); | |||||
if (error_free) { | if (error_free) { | ||||
map = {}; | map = {}; | ||||
opts = { | opts = { | ||||
@@ -2262,7 +2275,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; | |||||
OperationView.prototype.toggleOperationContent = function() { | OperationView.prototype.toggleOperationContent = function() { | ||||
var elem; | var elem; | ||||
elem = $('#' + Docs.escapeResourceName(this.model.parentId) + "_" + this.model.nickname + "_content"); | |||||
elem = $('#' + Docs.escapeResourceName(this.model.parentId + "_" + this.model.nickname + "_content")); | |||||
if (elem.is(':visible')) { | if (elem.is(':visible')) { | ||||
return Docs.collapseOperation(elem); | return Docs.collapseOperation(elem); | ||||
} else { | } else { | ||||
@@ -513,7 +513,11 @@ SwaggerClient.prototype.idFromOp = function(path, httpMethod, op) { | |||||
return (op.operationId); | return (op.operationId); | ||||
} | } | ||||
else { | else { | ||||
return path.substring(1).replace(/\//g, "_").replace(/\{/g, "").replace(/\}/g, "") + "_" + httpMethod; | |||||
return path.substring(1) | |||||
.replace(/\//g, "_") | |||||
.replace(/\{/g, "") | |||||
.replace(/\}/g, "") | |||||
.replace(/\./g, "_") + "_" + httpMethod; | |||||
} | } | ||||
} | } | ||||
@@ -658,8 +662,8 @@ Operation.prototype.getType = function (param) { | |||||
str = 'integer'; | str = 'integer'; | ||||
else if(type === 'integer' && format === 'int64') | else if(type === 'integer' && format === 'int64') | ||||
str = 'long'; | str = 'long'; | ||||
else if(type === 'integer' && typeof format === 'undefined') | |||||
str = 'long'; | |||||
else if(type === 'integer') | |||||
str = 'integer' | |||||
else if(type === 'string' && format === 'date-time') | else if(type === 'string' && format === 'date-time') | ||||
str = 'date-time'; | str = 'date-time'; | ||||
else if(type === 'string' && format === 'date') | else if(type === 'string' && format === 'date') | ||||
@@ -668,7 +672,7 @@ Operation.prototype.getType = function (param) { | |||||
str = 'float'; | str = 'float'; | ||||
else if(type === 'number' && format === 'double') | else if(type === 'number' && format === 'double') | ||||
str = 'double'; | str = 'double'; | ||||
else if(type === 'number' && typeof format === 'undefined') | |||||
else if(type === 'number') | |||||
str = 'double'; | str = 'double'; | ||||
else if(type === 'boolean') | else if(type === 'boolean') | ||||
str = 'boolean'; | str = 'boolean'; | ||||
@@ -878,7 +882,12 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) { | |||||
// todo append? | // todo append? | ||||
args.body = encoded; | args.body = encoded; | ||||
} | } | ||||
var url = this.scheme + '://' + this.host + this.basePath + requestUrl + querystring; | |||||
var url = this.scheme + '://' + this.host; | |||||
if(this.basePath !== '/') | |||||
url += this.basePath; | |||||
url += requestUrl + querystring; | |||||
var obj = { | var obj = { | ||||
url: url, | url: url, | ||||
@@ -1,5 +1,5 @@ | |||||
// swagger.js | // swagger.js | ||||
// version 2.0.46 | |||||
// version 2.0.47 | |||||
(function () { | (function () { | ||||
@@ -992,9 +992,14 @@ | |||||
output += encodeURIComponent(param[j]); | output += encodeURIComponent(param[j]); | ||||
} | } | ||||
queryParams += encodeURIComponent(param.name) + '=' + output; | queryParams += encodeURIComponent(param.name) + '=' + output; | ||||
} | |||||
else { | |||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | |||||
} | |||||
else { | |||||
if (args[param.name]) { | |||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]); | |||||
} else { | |||||
if (param.required) | |||||
throw "" + param.name + " is a required query param."; | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -1275,7 +1280,7 @@ | |||||
else if (this.type === "DELETE") | else if (this.type === "DELETE") | ||||
body = "{}"; | body = "{}"; | ||||
else if (this.type != "DELETE") | else if (this.type != "DELETE") | ||||
accepts = null; | |||||
consumes = null; | |||||
} | } | ||||
if (consumes && this.operation.consumes) { | if (consumes && this.operation.consumes) { | ||||
@@ -157,6 +157,13 @@ class OperationView extends Backbone.View | |||||
$(@).wiggle | $(@).wiggle | ||||
callback: => $(@).focus() | callback: => $(@).focus() | ||||
error_free = false | error_free = false | ||||
form.find("textarea.required").each -> | |||||
$(@).removeClass "error" | |||||
if jQuery.trim($(@).val()) is "" | |||||
$(@).addClass "error" | |||||
$(@).wiggle | |||||
callback: => $(@).focus() | |||||
error_free = false | |||||
# if error free submit it | # if error free submit it | ||||
if error_free | if error_free | ||||
@@ -420,5 +427,5 @@ class OperationView extends Backbone.View | |||||
if opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold then response_body_el else hljs.highlightBlock(response_body_el) | if opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold then response_body_el else hljs.highlightBlock(response_body_el) | ||||
toggleOperationContent: -> | toggleOperationContent: -> | ||||
elem = $('#' + Docs.escapeResourceName(@model.parentId) + "_" + @model.nickname + "_content") | |||||
elem = $('#' + Docs.escapeResourceName(@model.parentId + "_" + @model.nickname + "_content")) | |||||
if elem.is(':visible') then Docs.collapseOperation(elem) else Docs.expandOperation(elem) | if elem.is(':visible') then Docs.collapseOperation(elem) else Docs.expandOperation(elem) |
@@ -5,9 +5,9 @@ | |||||
<input type="file" name='{{name}}'/> | <input type="file" name='{{name}}'/> | ||||
{{else}} | {{else}} | ||||
{{#if default}} | {{#if default}} | ||||
<textarea class='body-textarea' placeholder='(required)' name='{{name}}'>{{default}}</textarea> | |||||
<textarea class='body-textarea required' placeholder='(required)' name='{{name}}'>{{default}}</textarea> | |||||
{{else}} | {{else}} | ||||
<textarea class='body-textarea' placeholder='(required)' name='{{name}}'></textarea> | |||||
<textarea class='body-textarea required' placeholder='(required)' name='{{name}}'></textarea> | |||||
<br /> | <br /> | ||||
<div class="parameter-content-type" /> | <div class="parameter-content-type" /> | ||||
{{/if}} | {{/if}} | ||||