Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 58B9F10173 for ; Sun, 2 Nov 2014 22:31:03 +0000 (UTC) Received: (qmail 44839 invoked by uid 500); 2 Nov 2014 22:31:03 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 44734 invoked by uid 500); 2 Nov 2014 22:31:03 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 44618 invoked by uid 99); 2 Nov 2014 22:31:03 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Nov 2014 22:31:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BDF80817F64; Sun, 2 Nov 2014 22:31:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: reta@apache.org To: commits@cxf.apache.org Date: Sun, 02 Nov 2014 22:31:03 -0000 Message-Id: <11d3e55c70594eb2adfcd3a0342a9485@git.apache.org> In-Reply-To: <62f23b37976446cf987434971de6d20b@git.apache.org> References: <62f23b37976446cf987434971de6d20b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/9] CXF-6046: Enhance SwaggerFeature to support JAX-RS annotations. Replaced embedded Swagger UI with webjar. http://git-wip-us.apache.org/repos/asf/cxf/blob/18204e5b/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/resources/swagger/swagger-ui.js ---------------------------------------------------------------------- diff --git a/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/resources/swagger/swagger-ui.js b/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/resources/swagger/swagger-ui.js deleted file mode 100644 index d0b7c97..0000000 --- a/distribution/src/main/release/samples/jax_rs/description_swagger/src/main/resources/swagger/swagger-ui.js +++ /dev/null @@ -1,2477 +0,0 @@ -// swagger-ui.js -// version 2.1.0-alpha.3 -$(function() { - - // Helper function for vertically aligning DOM elements - // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/ - $.fn.vAlign = function() { - return this.each(function(i){ - var ah = $(this).height(); - var ph = $(this).parent().height(); - var mh = (ph - ah) / 2; - $(this).css('margin-top', mh); - }); - }; - - $.fn.stretchFormtasticInputWidthToParent = function() { - return this.each(function(i){ - var p_width = $(this).closest("form").innerWidth(); - var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10); - var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10); - $(this).css('width', p_width - p_padding - this_padding); - }); - }; - - $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent(); - - // Vertically center these paragraphs - // Parent may need a min-height for this to work.. - $('ul.downplayed li div.content p').vAlign(); - - // When a sandbox form is submitted.. - $("form.sandbox").submit(function(){ - - var error_free = true; - - // Cycle through the forms required inputs - $(this).find("input.required").each(function() { - - // Remove any existing error styles from the input - $(this).removeClass('error'); - - // Tack the error style on if the input is empty.. - if ($(this).val() == '') { - $(this).addClass('error'); - $(this).wiggle(); - error_free = false; - } - - }); - - return error_free; - }); - -}); - -function clippyCopiedCallback(a) { - $('#api_key_copied').fadeIn().delay(1000).fadeOut(); - - // var b = $("#clippy_tooltip_" + a); - // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() { - // b.attr("title", "copy to clipboard") - // }, - // 500)) -} - -// Logging function that accounts for browsers that don't have window.console -log = function(){ - log.history = log.history || []; - log.history.push(arguments); - if(this.console){ - console.log( Array.prototype.slice.call(arguments)[0] ); - } -}; - -// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913) -if (Function.prototype.bind && console && typeof console.log == "object") { - [ - "log","info","warn","error","assert","dir","clear","profile","profileEnd" - ].forEach(function (method) { - console[method] = this.bind(console[method], console); - }, Function.prototype.call); -} - -var Docs = { - - shebang: function() { - - // If shebang has an operation nickname in it.. - // e.g. /docs/#!/words/get_search - var fragments = $.param.fragment().split('/'); - fragments.shift(); // get rid of the bang - - switch (fragments.length) { - case 1: - // Expand all operations for the resource and scroll to it - var dom_id = 'resource_' + fragments[0]; - - Docs.expandEndpointListForResource(fragments[0]); - $("#"+dom_id).slideto({highlight: false}); - break; - case 2: - // Refer to the endpoint DOM element, e.g. #words_get_search - - // Expand Resource - Docs.expandEndpointListForResource(fragments[0]); - $("#"+dom_id).slideto({highlight: false}); - - // Expand operation - var li_dom_id = fragments.join('_'); - var li_content_dom_id = li_dom_id + "_content"; - - - Docs.expandOperation($('#'+li_content_dom_id)); - $('#'+li_dom_id).slideto({highlight: false}); - break; - } - - }, - - toggleEndpointListForResource: function(resource) { - var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints'); - if (elem.is(':visible')) { - Docs.collapseEndpointListForResource(resource); - } else { - Docs.expandEndpointListForResource(resource); - } - }, - - // Expand resource - expandEndpointListForResource: function(resource) { - var resource = Docs.escapeResourceName(resource); - if (resource == '') { - $('.resource ul.endpoints').slideDown(); - return; - } - - $('li#resource_' + resource).addClass('active'); - - var elem = $('li#resource_' + resource + ' ul.endpoints'); - elem.slideDown(); - }, - - // Collapse resource and mark as explicitly closed - collapseEndpointListForResource: function(resource) { - var resource = Docs.escapeResourceName(resource); - $('li#resource_' + resource).removeClass('active'); - - var elem = $('li#resource_' + resource + ' ul.endpoints'); - elem.slideUp(); - }, - - expandOperationsForResource: function(resource) { - // Make sure the resource container is open.. - Docs.expandEndpointListForResource(resource); - - if (resource == '') { - $('.resource ul.endpoints li.operation div.content').slideDown(); - return; - } - - $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { - Docs.expandOperation($(this)); - }); - }, - - collapseOperationsForResource: function(resource) { - // Make sure the resource container is open.. - Docs.expandEndpointListForResource(resource); - - $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() { - Docs.collapseOperation($(this)); - }); - }, - - escapeResourceName: function(resource) { - return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&"); - }, - - expandOperation: function(elem) { - elem.slideDown(); - }, - - collapseOperation: function(elem) { - elem.slideUp(); - } -};(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", self=this; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n"; - return buffer; - } -function program2(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program4(depth0,data) { - - - return "\n \n"; - } - - buffer += "\n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this; - -function program1(depth0,data) { - - var buffer = "", stack1, stack2; - buffer += "\n
" - + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "
\n
"; - stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1); - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "
\n "; - stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n "; - stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data}); - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n "; - stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license), {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data}); - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n "; - return buffer; - } -function program2(depth0,data) { - - var buffer = "", stack1; - buffer += ""; - return buffer; - } - -function program4(depth0,data) { - - var buffer = "", stack1; - buffer += ""; - return buffer; - } - -function program6(depth0,data) { - - var buffer = "", stack1; - buffer += ""; - return buffer; - } - -function program8(depth0,data) { - - var buffer = "", stack1; - buffer += "\n , api version: " - + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.version)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "\n "; - return buffer; - } - -function program10(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n \n "; - return buffer; - } - - buffer += "
\n "; - stack1 = helpers['if'].call(depth0, depth0.info, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n
\n
\n
    \n
\n\n
\n
\n
\n

[ base url: "; - if (stack1 = helpers.basePath) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.basePath; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n "; - stack2 = helpers['if'].call(depth0, ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.version), {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data}); - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "]\n "; - stack2 = helpers['if'].call(depth0, depth0.validatorUrl, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data}); - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n

\n
\n
\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing; - -function program1(depth0,data) { - - - return "deprecated"; - } - -function program3(depth0,data) { - - - return "\n

Warning: Deprecated

\n "; - } - -function program5(depth0,data) { - - var buffer = "", stack1; - buffer += "\n

Implementation Notes

\n

"; - if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "

\n "; - return buffer; - } - -function program7(depth0,data) { - - - return "\n
\n "; - } - -function program9(depth0,data) { - - var buffer = "", stack1; - buffer += "\n
\n "; - stack1 = helpers.each.call(depth0, depth0, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n
\n "; - return buffer; - } -function program10(depth0,data) { - - var buffer = "", stack1, stack2; - buffer += "\n
" - + escapeExpression(((stack1 = depth0.scope),typeof stack1 === functionType ? stack1.apply(depth0) : stack1)) - + "
\n "; - return buffer; - } - -function program12(depth0,data) { - - - return "
"; - } - -function program14(depth0,data) { - - - return "\n
\n \n
\n "; - } - -function program16(depth0,data) { - - - return "\n

Response Class

\n

\n
\n
\n "; - } - -function program18(depth0,data) { - - - return "\n

Parameters

\n \n \n \n \n \n \n \n \n \n \n \n\n \n
ParameterValueDescriptionParameter TypeData Type
\n "; - } - -function program20(depth0,data) { - - - return "\n
\n

Response Messages

\n \n \n \n \n \n \n \n \n \n \n \n
HTTP Status CodeReasonResponse Model
\n "; - } - -function program22(depth0,data) { - - - return "\n "; - } - -function program24(depth0,data) { - - - return "\n
\n \n \n \n
\n "; - } - - buffer += "\n \n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['param'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program2(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n
\n "; - return buffer; - } - -function program4(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program5(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program7(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n
\n
\n "; - return buffer; - } - -function program9(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(10, program10, data),fn:self.program(2, program2, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program10(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(13, program13, data),fn:self.program(11, program11, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program11(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program13(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - - buffer += ""; - if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n\n\n "; - stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n\n"; - if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n"; - if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n \n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, stack2, options, self=this, helperMissing=helpers.helperMissing, functionType="function", escapeExpression=this.escapeExpression; - -function program1(depth0,data) { - - - return " multiple='multiple'"; - } - -function program3(depth0,data) { - - - return "\n "; - } - -function program5(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(8, program8, data),fn:self.program(6, program6, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program6(depth0,data) { - - - return "\n "; - } - -function program8(depth0,data) { - - var buffer = "", stack1, stack2, options; - buffer += "\n "; - options = {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data}; - stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options)); - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n "; - return buffer; - } -function program9(depth0,data) { - - - return "\n "; - } - -function program11(depth0,data) { - - - return "\n \n "; - } - -function program13(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.isDefault, {hash:{},inverse:self.program(16, program16, data),fn:self.program(14, program14, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program14(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program16(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - - buffer += ""; - if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n\n \n\n"; - if (stack2 = helpers.description) { stack2 = stack2.call(depth0, {hash:{},data:data}); } - else { stack2 = depth0.description; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; } - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n"; - if (stack2 = helpers.paramType) { stack2 = stack2.call(depth0, {hash:{},data:data}); } - else { stack2 = depth0.paramType; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; } - if(stack2 || stack2 === 0) { buffer += stack2; } - buffer += "\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['param_readonly'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program3(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program4(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n "; - return buffer; - } - -function program6(depth0,data) { - - - return "\n (empty)\n "; - } - - buffer += ""; - if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n\n "; - stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n"; - if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n"; - if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['param_readonly_required'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program3(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program4(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n "; - return buffer; - } - -function program6(depth0,data) { - - - return "\n (empty)\n "; - } - - buffer += ""; - if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n\n "; - stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n"; - if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n"; - if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['param_required'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program2(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program4(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program5(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program7(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n
\n
\n "; - return buffer; - } - -function program9(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program10(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program12(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(15, program15, data),fn:self.program(13, program13, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n "; - return buffer; - } -function program13(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program15(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - - buffer += ""; - if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n\n "; - stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n\n "; - if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n"; - if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['parameter_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", self=this; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers.each.call(depth0, depth0.consumes, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n"; - return buffer; - } -function program2(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program4(depth0,data) { - - - return "\n \n"; - } - - buffer += "\n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['resource'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing; - -function program1(depth0,data) { - - - return " : "; - } - -function program3(depth0,data) { - - var buffer = "", stack1; - buffer += "
  • \n Raw\n
  • "; - return buffer; - } - - buffer += "
    \n

    \n "; - if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + " "; - options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data}; - if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, options); } - else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); } - if(stack1 || stack1 === 0) { buffer += stack1; } - if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n

    \n
      \n
    • \n Show/Hide\n
    • \n
    • \n \n List Operations\n \n
    • \n
    • \n \n Expand Operations\n \n
    • \n "; - options = {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data}; - if (stack1 = helpers.url) { stack1 = stack1.call(depth0, options); } - else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n
    \n
    \n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['response_content_type'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", self=this; - -function program1(depth0,data) { - - var buffer = "", stack1; - buffer += "\n "; - stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data}); - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n"; - return buffer; - } -function program2(depth0,data) { - - var buffer = "", stack1; - buffer += "\n \n "; - return buffer; - } - -function program4(depth0,data) { - - - return "\n \n"; - } - - buffer += "\n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['signature'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression; - - - buffer += "
    \n\n
    \n\n
    \n
    \n "; - if (stack1 = helpers.signature) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.signature; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n
    \n\n
    \n
    ";
    -  if (stack1 = helpers.sampleJSON) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
    -  else { stack1 = depth0.sampleJSON; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
    -  buffer += escapeExpression(stack1)
    -    + "
    \n \n
    \n
    \n\n"; - return buffer; - }); -})(); - -(function() { - var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {}; -templates['status_code'] = template(function (Handlebars,depth0,helpers,partials,data) { - this.compilerInfo = [4,'>= 1.0.0']; -helpers = this.merge(helpers, Handlebars.helpers); data = data || {}; - var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression; - - - buffer += ""; - if (stack1 = helpers.code) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - buffer += escapeExpression(stack1) - + "\n"; - if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); } - else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; } - if(stack1 || stack1 === 0) { buffer += stack1; } - buffer += "\n"; - return buffer; - }); -})(); - - - -// Generated by CoffeeScript 1.6.3 -(function() { - var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, - __hasProp = {}.hasOwnProperty, - __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; }; - - SwaggerUi = (function(_super) { - __extends(SwaggerUi, _super); - - function SwaggerUi() { - _ref = SwaggerUi.__super__.constructor.apply(this, arguments); - return _ref; - } - - SwaggerUi.prototype.dom_id = "swagger_ui"; - - SwaggerUi.prototype.options = null; - - SwaggerUi.prototype.api = null; - - SwaggerUi.prototype.headerView = null; - - SwaggerUi.prototype.mainView = null; - - SwaggerUi.prototype.initialize = function(options) { - var _this = this; - if (options == null) { - options = {}; - } - if (options.dom_id != null) { - this.dom_id = options.dom_id; - delete options.dom_id; - } - if ($('#' + this.dom_id) == null) { - $('body').append('
    '); - } - this.options = options; - this.options.success = function() { - return _this.render(); - }; - this.options.progress = function(d) { - return _this.showMessage(d); - }; - this.options.failure = function(d) { - if (_this.api && _this.api.isValid === false) { - log("not a valid 2.0 spec, loading legacy client"); - _this.api = new SwaggerApi(_this.options); - return _this.api.build(); - } else { - return _this.onLoadFailure(d); - } - }; - this.headerView = new HeaderView({ - el: $('#header') - }); - return this.headerView.on('update-swagger-ui', function(data) { - return _this.updateSwaggerUi(data); - }); - }; - - SwaggerUi.prototype.setOption = function(option, value) { - return this.options[option] = value; - }; - - SwaggerUi.prototype.getOption = function(option) { - return this.options[option]; - }; - - SwaggerUi.prototype.updateSwaggerUi = function(data) { - this.options.url = data.url; - return this.load(); - }; - - SwaggerUi.prototype.load = function() { - var url, _ref1; - if ((_ref1 = this.mainView) != null) { - _ref1.clear(); - } - url = this.options.url; - if (url.indexOf("http") !== 0) { - url = this.buildUrl(window.location.href.toString(), url); - } - this.options.url = url; - this.headerView.update(url); - this.api = new SwaggerClient(this.options); - return this.api.build(); - }; - - SwaggerUi.prototype.render = function() { - var _this = this; - this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...'); - this.mainView = new MainView({ - model: this.api, - el: $('#' + this.dom_id), - swaggerOptions: this.options - }).render(); - this.showMessage(); - switch (this.options.docExpansion) { - case "full": - Docs.expandOperationsForResource(''); - break; - case "list": - Docs.collapseOperationsForResource(''); - } - if (this.options.onComplete) { - this.options.onComplete(this.api, this); - } - return setTimeout(function() { - return Docs.shebang(); - }, 400); - }; - - SwaggerUi.prototype.buildUrl = function(base, url) { - var endOfPath, parts; - log("base is " + base); - if (url.indexOf("/") === 0) { - parts = base.split("/"); - base = parts[0] + "//" + parts[2]; - return base + url; - } else { - endOfPath = base.length; - if (base.indexOf("?") > -1) { - endOfPath = Math.min(endOfPath, base.indexOf("?")); - } - if (base.indexOf("#") > -1) { - endOfPath = Math.min(endOfPath, base.indexOf("#")); - } - base = base.substring(0, endOfPath); - if (base.indexOf("/", base.length - 1) !== -1) { - return base + url; - } - return base + "/" + url; - } - }; - - SwaggerUi.prototype.showMessage = function(data) { - if (data == null) { - data = ''; - } - $('#message-bar').removeClass('message-fail'); - $('#message-bar').addClass('message-success'); - return $('#message-bar').html(data); - }; - - SwaggerUi.prototype.onLoadFailure = function(data) { - var val; - if (data == null) { - data = ''; - } - $('#message-bar').removeClass('message-success'); - $('#message-bar').addClass('message-fail'); - val = $('#message-bar').html(data); - if (this.options.onFailure != null) { - this.options.onFailure(data); - } - return val; - }; - - return SwaggerUi; - - })(Backbone.Router); - - window.SwaggerUi = SwaggerUi; - - HeaderView = (function(_super) { - __extends(HeaderView, _super); - - function HeaderView() { - _ref1 = HeaderView.__super__.constructor.apply(this, arguments); - return _ref1; - } - - HeaderView.prototype.events = { - 'click #show-pet-store-icon': 'showPetStore', - 'click #show-wordnik-dev-icon': 'showWordnikDev', - 'click #explore': 'showCustom', - 'keyup #input_baseUrl': 'showCustomOnKeyup', - 'keyup #input_apiKey': 'showCustomOnKeyup' - }; - - HeaderView.prototype.initialize = function() {}; - - HeaderView.prototype.showPetStore = function(e) { - return this.trigger('update-swagger-ui', { - url: "http://petstore.swagger.wordnik.com/api/api-docs" - }); - }; - - HeaderView.prototype.showWordnikDev = function(e) { - return this.trigger('update-swagger-ui', { - url: "http://api.wordnik.com/v4/resources.json" - }); - }; - - HeaderView.prototype.showCustomOnKeyup = function(e) { - if (e.keyCode === 13) { - return this.showCustom(); - } - }; - - HeaderView.prototype.showCustom = function(e) { - if (e != null) { - e.preventDefault(); - } - return this.trigger('update-swagger-ui', { - url: $('#input_baseUrl').val(), - apiKey: $('#input_apiKey').val() - }); - }; - - HeaderView.prototype.update = function(url, apiKey, trigger) { - if (trigger == null) { - trigger = false; - } - $('#input_baseUrl').val(url); - if (trigger) { - return this.trigger('update-swagger-ui', { - url: url - }); - } - }; - - return HeaderView; - - })(Backbone.View); - - MainView = (function(_super) { - var sorters; - - __extends(MainView, _super); - - function MainView() { - _ref2 = MainView.__super__.constructor.apply(this, arguments); - return _ref2; - } - - sorters = { - 'alpha': function(a, b) { - return a.path.localeCompare(b.path); - }, - 'method': function(a, b) { - return a.method.localeCompare(b.method); - } - }; - - MainView.prototype.initialize = function(opts) { - var name, route, sorter, sorterName, url, _i, _len, _ref3; - if (opts == null) { - opts = {}; - } - if (opts.swaggerOptions.sorter) { - sorterName = opts.swaggerOptions.sorter; - sorter = sorters[sorterName]; - if (this.model.apisArray) { - _ref3 = this.model.apisArray; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - route = _ref3[_i]; - route.operationsArray.sort(sorter); - } - if (sorterName === "alpha") { - this.model.apisArray.sort(sorter); - } - } - } - 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 ("validatorUrl" in opts.swaggerOptions) { - return this.model.validatorUrl = opts.swaggerOptions.validatorUrl; - } else if (this.model.url.match(/https?:\/\/localhost/) && this.model.swaggerVersion === 2) { - return this.model.validatorUrl = this.model.url; - } else { - return this.model.validatorUrl = "http://online.swagger.io/validator"; - } - }; - - MainView.prototype.render = function() { - var counter, id, resource, resources, _i, _len, _ref3; - $(this.el).html(Handlebars.templates.main(this.model)); - resources = {}; - counter = 0; - _ref3 = this.model.apisArray; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - resource = _ref3[_i]; - id = resource.name; - while (typeof resources[id] !== 'undefined') { - id = id + "_" + counter; - counter += 1; - } - resource.id = id; - resources[id] = resource; - this.addResource(resource); - } - return this; - }; - - MainView.prototype.addResource = function(resource) { - var resourceView; - resource.id = resource.id.replace(/\s/g, '_'); - resourceView = new ResourceView({ - model: resource, - tagName: 'li', - id: 'resource_' + resource.id, - className: 'resource', - swaggerOptions: this.options.swaggerOptions - }); - return $('#resources').append(resourceView.render().el); - }; - - MainView.prototype.clear = function() { - return $(this.el).html(''); - }; - - return MainView; - - })(Backbone.View); - - ResourceView = (function(_super) { - __extends(ResourceView, _super); - - function ResourceView() { - _ref3 = ResourceView.__super__.constructor.apply(this, arguments); - return _ref3; - } - - ResourceView.prototype.initialize = function() { - if ("" === this.model.description) { - return this.model.description = null; - } - }; - - ResourceView.prototype.render = function() { - var counter, id, methods, operation, _i, _len, _ref4; - $(this.el).html(Handlebars.templates.resource(this.model)); - methods = {}; - if (this.model.description) { - this.model.summary = this.model.description; - } - _ref4 = this.model.operationsArray; - for (_i = 0, _len = _ref4.length; _i < _len; _i++) { - operation = _ref4[_i]; - counter = 0; - id = operation.nickname; - while (typeof methods[id] !== 'undefined') { - id = id + "_" + counter; - counter += 1; - } - methods[id] = operation; - operation.nickname = id; - operation.parentId = this.model.id; - this.addOperation(operation); - } - $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource')); - $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource')); - $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource')); - return this; - }; - - ResourceView.prototype.addOperation = function(operation) { - var operationView; - operation.number = this.number; - operationView = new OperationView({ - model: operation, - tagName: 'li', - className: 'endpoint', - swaggerOptions: this.options.swaggerOptions - }); - $('.endpoints', $(this.el)).append(operationView.render().el); - return this.number++; - }; - - ResourceView.prototype.callDocs = function(fnName, e) { - e.preventDefault(); - return Docs[fnName](e.currentTarget.getAttribute('data-id')); - }; - - return ResourceView; - - })(Backbone.View); - - OperationView = (function(_super) { - __extends(OperationView, _super); - - function OperationView() { - _ref4 = OperationView.__super__.constructor.apply(this, arguments); - return _ref4; - } - - OperationView.prototype.invocationUrl = null; - - OperationView.prototype.events = { - 'submit .sandbox': 'submitOperation', - 'click .submit': 'submitOperation', - 'click .response_hider': 'hideResponse', - 'click .toggleOperation': 'toggleOperationContent', - 'mouseenter .api-ic': 'mouseEnter', - 'mouseout .api-ic': 'mouseExit' - }; - - OperationView.prototype.initialize = function() {}; - - OperationView.prototype.mouseEnter = function(e) { - var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y; - elem = $(e.currentTarget.parentNode).find('#api_information_panel'); - x = e.pageX; - y = e.pageY; - scX = $(window).scrollLeft(); - scY = $(window).scrollTop(); - scMaxX = scX + $(window).width(); - scMaxY = scY + $(window).height(); - wd = elem.width(); - hgh = elem.height(); - if (x + wd > scMaxX) { - x = scMaxX - wd; - } - if (x < scX) { - x = scX; - } - if (y + hgh > scMaxY) { - y = scMaxY - hgh; - } - if (y < scY) { - y = scY; - } - pos = {}; - pos.top = y; - pos.left = x; - elem.css(pos); - return $(e.currentTarget.parentNode).find('#api_information_panel').show(); - }; - - OperationView.prototype.mouseExit = function(e) { - return $(e.currentTarget.parentNode).find('#api_information_panel').hide(); - }; - - OperationView.prototype.render = function() { - var code, contentTypeModel, isMethodSubmissionSupported, k, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, signatureModel, statusCode, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8, _ref9; - isMethodSubmissionSupported = true; - if (!isMethodSubmissionSupported) { - this.model.isReadOnly = true; - } - this.model.description = this.model.description || this.model.notes; - if (this.model.description) { - this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '
    '); - } - this.model.oauth = null; - if (this.model.authorizations) { - _ref5 = this.model.authorizations; - for (k in _ref5) { - v = _ref5[k]; - if (k === "oauth2") { - if (this.model.oauth === null) { - this.model.oauth = {}; - } - if (this.model.oauth.scopes === void 0) { - this.model.oauth.scopes = []; - } - for (_i = 0, _len = v.length; _i < _len; _i++) { - o = v[_i]; - this.model.oauth.scopes.push(o); - } - } - } - } - if (typeof this.model.responses !== 'undefined') { - this.model.responseMessages = []; - _ref6 = this.model.responses; - for (code in _ref6) { - value = _ref6[code]; - schema = null; - schemaObj = this.model.responses[code].schema; - if (schemaObj && schemaObj['$ref']) { - schema = schemaObj['$ref']; - if (schema.indexOf('#/definitions/') === 0) { - schema = schema.substring('#/definitions/'.length); - } - } - this.model.responseMessages.push({ - code: code, - message: value.description, - responseModel: schema - }); - } - } - if (typeof this.model.responseMessages === 'undefined') { - this.model.responseMessages = []; - } - $(this.el).html(Handlebars.templates.operation(this.model)); - if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') { - signatureModel = { - sampleJSON: this.model.responseSampleJSON, - isParam: false, - signature: this.model.responseClassSignature - }; - responseSignatureView = new SignatureView({ - model: signatureModel, - tagName: 'div' - }); - $('.model-signature', $(this.el)).append(responseSignatureView.render().el); - } else { - this.model.responseClassSignature = 'string'; - $('.model-signature', $(this.el)).html(this.model.type); - } - contentTypeModel = { - isParam: false - }; - contentTypeModel.consumes = this.model.consumes; - contentTypeModel.produces = this.model.produces; - _ref7 = this.model.parameters; - for (_j = 0, _len1 = _ref7.length; _j < _len1; _j++) { - param = _ref7[_j]; - type = param.type || param.dataType; - if (typeof type === 'undefined') { - schema = param.schema; - if (schema && schema['$ref']) { - ref = schema['$ref']; - if (ref.indexOf('#/definitions/') === 0) { - type = ref.substring('#/definitions/'.length); - } else { - type = ref; - } - } - } - if (type && type.toLowerCase() === 'file') { - if (!contentTypeModel.consumes) { - contentTypeModel.consumes = 'multipart/form-data'; - } - } - param.type = type; - } - responseContentTypeView = new ResponseContentTypeView({ - model: contentTypeModel - }); - $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el); - _ref8 = this.model.parameters; - for (_k = 0, _len2 = _ref8.length; _k < _len2; _k++) { - param = _ref8[_k]; - this.addParameter(param, contentTypeModel.consumes); - } - _ref9 = this.model.responseMessages; - for (_l = 0, _len3 = _ref9.length; _l < _len3; _l++) { - statusCode = _ref9[_l]; - this.addStatusCode(statusCode); - } - return this; - }; - - OperationView.prototype.addParameter = function(param, consumes) { - var paramView; - param.consumes = consumes; - paramView = new ParameterView({ - model: param, - tagName: 'tr', - readOnly: this.model.isReadOnly - }); - return $('.operation-params', $(this.el)).append(paramView.render().el); - }; - - OperationView.prototype.addStatusCode = function(statusCode) { - var statusCodeView; - statusCodeView = new StatusCodeView({ - model: statusCode, - tagName: 'tr' - }); - return $('.operation-status', $(this.el)).append(statusCodeView.render().el); - }; - - OperationView.prototype.submitOperation = function(e) { - var error_free, form, isFileUpload, map, o, opts, val, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7; - if (e != null) { - e.preventDefault(); - } - form = $('.sandbox', $(this.el)); - error_free = true; - form.find("input.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) { - map = {}; - opts = { - parent: this - }; - isFileUpload = false; - _ref5 = form.find("input"); - for (_i = 0, _len = _ref5.length; _i < _len; _i++) { - o = _ref5[_i]; - if ((o.value != null) && jQuery.trim(o.value).length > 0) { - map[o.name] = o.value; - } - if (o.type === "file") { - isFileUpload = true; - } - } - _ref6 = form.find("textarea"); - for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) { - o = _ref6[_j]; - if ((o.value != null) && jQuery.trim(o.value).length > 0) { - map[o.name] = o.value; - } - } - _ref7 = form.find("select"); - for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) { - o = _ref7[_k]; - val = this.getSelectedValue(o); - if ((val != null) && jQuery.trim(val).length > 0) { - map[o.name] = val; - } - } - opts.responseContentType = $("div select[name=responseContentType]", $(this.el)).val(); - opts.requestContentType = $("div select[name=parameterContentType]", $(this.el)).val(); - $(".response_throbber", $(this.el)).show(); - if (isFileUpload) { - return this.handleFileUpload(map, form); - } else { - return this.model["do"](map, opts, this.showCompleteStatus, this.showErrorStatus, this); - } - } - }; - - OperationView.prototype.success = function(response, parent) { - return parent.showCompleteStatus(response); - }; - - OperationView.prototype.handleFileUpload = function(map, form) { - var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8, - _this = this; - _ref5 = form.serializeArray(); - for (_i = 0, _len = _ref5.length; _i < _len; _i++) { - o = _ref5[_i]; - if ((o.value != null) && jQuery.trim(o.value).length > 0) { - map[o.name] = o.value; - } - } - bodyParam = new FormData(); - params = 0; - _ref6 = this.model.parameters; - for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) { - param = _ref6[_j]; - if (param.paramType === 'form') { - if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) { - bodyParam.append(param.name, map[param.name]); - } - } - } - headerParams = {}; - _ref7 = this.model.parameters; - for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) { - param = _ref7[_k]; - if (param.paramType === 'header') { - headerParams[param.name] = map[param.name]; - } - } - _ref8 = form.find('input[type~="file"]'); - for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) { - el = _ref8[_l]; - if (typeof el.files[0] !== 'undefined') { - bodyParam.append($(el).attr('name'), el.files[0]); - params += 1; - } - } - this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true); - $(".request_url", $(this.el)).html("
    ");
    -      $(".request_url pre", $(this.el)).text(this.invocationUrl);
    -      obj = {
    -        type: this.model.method,
    -        url: this.invocationUrl,
    -        headers: headerParams,
    -        data: bodyParam,
    -        dataType: 'json',
    -        contentType: false,
    -        processData: false,
    -        error: function(data, textStatus, error) {
    -          return _this.showErrorStatus(_this.wrap(data), _this);
    -        },
    -        success: function(data) {
    -          return _this.showResponse(data, _this);
    -        },
    -        complete: function(data) {
    -          return _this.showCompleteStatus(_this.wrap(data), _this);
    -        }
    -      };
    -      if (window.authorizations) {
    -        window.authorizations.apply(obj);
    -      }
    -      if (params === 0) {
    -        obj.data.append("fake", "true");
    -      }
    -      jQuery.ajax(obj);
    -      return false;
    -    };
    -
    -    OperationView.prototype.wrap = function(data) {
    -      var h, headerArray, headers, i, o, _i, _len;
    -      headers = {};
    -      headerArray = data.getAllResponseHeaders().split("\r");
    -      for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
    -        i = headerArray[_i];
    -        h = i.split(':');
    -        if (h[0] !== void 0 && h[1] !== void 0) {
    -          headers[h[0].trim()] = h[1].trim();
    -        }
    -      }
    -      o = {};
    -      o.content = {};
    -      o.content.data = data.responseText;
    -      o.headers = headers;
    -      o.request = {};
    -      o.request.url = this.invocationUrl;
    -      o.status = data.status;
    -      return o;
    -    };
    -
    -    OperationView.prototype.getSelectedValue = function(select) {
    -      var opt, options, _i, _len, _ref5;
    -      if (!select.multiple) {
    -        return select.value;
    -      } else {
    -        options = [];
    -        _ref5 = select.options;
    -        for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
    -          opt = _ref5[_i];
    -          if (opt.selected) {
    -            options.push(opt.value);
    -          }
    -        }
    -        if (options.length > 0) {
    -          return options;
    -        } else {
    -          return null;
    -        }
    -      }
    -    };
    -
    -    OperationView.prototype.hideResponse = function(e) {
    -      if (e != null) {
    -        e.preventDefault();
    -      }
    -      $(".response", $(this.el)).slideUp();
    -      return $(".response_hider", $(this.el)).fadeOut();
    -    };
    -
    -    OperationView.prototype.showResponse = function(response) {
    -      var prettyJson;
    -      prettyJson = JSON.stringify(response, null, "\t").replace(/\n/g, "
    "); - return $(".response_body", $(this.el)).html(escape(prettyJson)); - }; - - OperationView.prototype.showErrorStatus = function(data, parent) { - return parent.showStatus(data); - }; - - OperationView.prototype.showCompleteStatus = function(data, parent) { - return parent.showStatus(data); - }; - - OperationView.prototype.formatXml = function(xml) { - var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len; - reg = /(>)(<)(\/*)/g; - wsexp = /[ ]*(.*)[ ]+\n/g; - contexp = /(<.+>)(.+\n)/g; - xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2'); - pad = 0; - formatted = ''; - lines = xml.split('\n'); - indent = 0; - lastType = 'other'; - transitions = { - 'single->single': 0, - 'single->closing': -1, - 'single->opening': 0, - 'single->other': 0, - 'closing->single': 0, - 'closing->closing': -1, - 'closing->opening': 0, - 'closing->other': 0, - 'opening->single': 1, - 'opening->closing': 0, - 'opening->opening': 1, - 'opening->other': 1, - 'other->single': 0, - 'other->closing': -1, - 'other->opening': 0, - 'other->other': 0 - }; - _fn = function(ln) { - var fromTo, j, key, padding, type, types, value; - types = { - single: Boolean(ln.match(/<.+\/>/)), - closing: Boolean(ln.match(/<\/.+>/)), - opening: Boolean(ln.match(/<[^!?].*>/)) - }; - type = ((function() { - var _results; - _results = []; - for (key in types) { - value = types[key]; - if (value) { - _results.push(key); - } - } - return _results; - })())[0]; - type = type === void 0 ? 'other' : type; - fromTo = lastType + '->' + type; - lastType = type; - padding = ''; - indent += transitions[fromTo]; - padding = ((function() { - var _j, _ref5, _results; - _results = []; - for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) { - _results.push(' '); - } - return _results; - })()).join(''); - if (fromTo === 'opening->closing') { - return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n'; - } else { - return formatted += padding + ln + '\n'; - } - }; - for (_i = 0, _len = lines.length; _i < _len; _i++) { - ln = lines[_i]; - _fn(ln); - } - return formatted; - }; - - OperationView.prototype.showStatus = function(response) { - var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url; - if (response.content === void 0) { - content = response.data; - url = response.url; - } else { - content = response.content.data; - url = response.request.url; - } - headers = response.headers; - contentType = headers && headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null; - if (!content) { - code = $('').text("no content"); - pre = $('
    ').append(code);
    -      } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
    -        json = null;
    -        try {
    -          json = JSON.stringify(JSON.parse(content), null, "  ");
    -        } catch (_error) {
    -          e