Hi Jo,
This is the customization diff we currently have in swagger-ui. I'm in the
process of merging these fixes with new version.
Thanks,
Bhathiya
On Thu, Jan 14, 2016 at 3:02 PM, Bhathiya Jayasekara <[email protected]>
wrote:
> Thanks. Will do.
>
> On Thu, Jan 14, 2016 at 3:02 PM, Joseph Fonseka <[email protected]> wrote:
>
>> Hi Bhathiya
>>
>> We have some customizations so you need to merge them to the new
>> libraries before updating.
>>
>> Thanks
>> Jo
>>
>> On Thu, Jan 14, 2016 at 2:53 PM, Bhathiya Jayasekara <[email protected]>
>> wrote:
>>
>>> Hi Jo,
>>>
>>> I'm trying to do $subject. I had a look at store code, and as I
>>> understood I have to do following.
>>>
>>> 1) Replace *swagger-ui.min.js* and *swagger-ui.js* in store with new
>>> version.
>>> 2) Replace *swagger-editor *in publisher with new version.
>>>
>>> Are there anything else I have to do?
>>>
>>> And can we simply replace above? Or do we have any customizations?
>>>
>>> Thanks,
>>> Bhathiya
>>>
>>> --
>>> *Bhathiya Jayasekara*
>>> *Senior Software Engineer,*
>>> *WSO2 inc., http://wso2.com <http://wso2.com>*
>>>
>>> *Phone: +94715478185 <%2B94715478185>*
>>> *LinkedIn: http://www.linkedin.com/in/bhathiyaj
>>> <http://www.linkedin.com/in/bhathiyaj>*
>>> *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>*
>>> *Blog: http://movingaheadblog.blogspot.com
>>> <http://movingaheadblog.blogspot.com/>*
>>>
>>
>>
>>
>> --
>>
>> --
>> *Joseph Fonseka*
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 772 512 430
>> skype: jpfonseka
>>
>> * <http://lk.linkedin.com/in/rumeshbandara>*
>>
>>
>
>
> --
> *Bhathiya Jayasekara*
> *Senior Software Engineer,*
> *WSO2 inc., http://wso2.com <http://wso2.com>*
>
> *Phone: +94715478185 <%2B94715478185>*
> *LinkedIn: http://www.linkedin.com/in/bhathiyaj
> <http://www.linkedin.com/in/bhathiyaj>*
> *Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>*
> *Blog: http://movingaheadblog.blogspot.com
> <http://movingaheadblog.blogspot.com/>*
>
--
*Bhathiya Jayasekara*
*Senior Software Engineer,*
*WSO2 inc., http://wso2.com <http://wso2.com>*
*Phone: +94715478185*
*LinkedIn: http://www.linkedin.com/in/bhathiyaj
<http://www.linkedin.com/in/bhathiyaj>*
*Twitter: https://twitter.com/bhathiyax <https://twitter.com/bhathiyax>*
*Blog: http://movingaheadblog.blogspot.com
<http://movingaheadblog.blogspot.com/>*
Common subdirectories: ./css and /home/bhathiya/work/swagger
update/211/swagger-ui-2.1.1/dist/css
Only in .: diff.txt
Common subdirectories: ./fonts and /home/bhathiya/work/swagger
update/211/swagger-ui-2.1.1/dist/fonts
Common subdirectories: ./images and /home/bhathiya/work/swagger
update/211/swagger-ui-2.1.1/dist/images
diff ./index.html "/home/bhathiya/work/swagger
update/211/swagger-ui-2.1.1/dist/index.html"
3a4
> <meta charset="UTF-8">
23a25,29
> <!-- Some basic translations -->
> <!-- <script src='lang/translator.js' type='text/javascript'></script> -->
> <!-- <script src='lang/ru.js' type='text/javascript'></script> -->
> <!-- <script src='lang/en.js' type='text/javascript'></script> -->
>
31a38,42
>
> // Pre load translate...
> if(window.SwaggerTranslator) {
> window.SwaggerTranslator.translate();
> }
39a51
> clientSecret: "your-client-secret",
41c53,54
< appName: "your-app-name"
---
> appName: "your-app-name",
> scopeSeparator: ","
44a58,61
> if(window.SwaggerTranslator) {
> window.SwaggerTranslator.translate();
> }
>
94c111
< <div class='input'><a id="explore" href="#">Explore</a></div>
---
> <div class='input'><a id="explore" href="#"
> data-sw-translate>Explore</a></div>
99c116
< <div id="message-bar" class="swagger-ui-wrap"> </div>
---
> <div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
Only in /home/bhathiya/work/swagger update/211/swagger-ui-2.1.1/dist: lang
Common subdirectories: ./lib and /home/bhathiya/work/swagger
update/211/swagger-ui-2.1.1/dist/lib
diff ./swagger-ui.js "/home/bhathiya/work/swagger
update/211/swagger-ui-2.1.1/dist/swagger-ui.js"
7,9c7,43
< (function(){'use strict';
<
< window.SwaggerUi = Backbone.Router.extend({
---
> (function(){this["Handlebars"] = this["Handlebars"] || {};
> this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
> this["Handlebars"]["templates"]["apikey_button_view"] =
> Handlebars.template({"compiler":[6,">=
> 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
> var helper, functionType="function", helperMissing=helpers.helperMissing,
> escapeExpression=this.escapeExpression;
> return "<!--div class='auth_button' id='apikey_button'><img
> class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div
> class='auth_container' id='apikey_container'>\n <div
> class='key_input_container'>\n <div class='auth_label'><label
> for='input_apiKey_entry'>"
> + escapeExpression(((helper = (helper = helpers.keyName || (depth0 !=
> null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof
> helper === functionType ? helper.call(depth0,
> {"name":"keyName","hash":{},"data":data}) : helper)))
> + "</label></div>\n <input placeholder='api_key' class='auth_input'
> id='input_apiKey_entry' name='apiKey' type='text'/>\n <div
> class='auth_submit'><a class='auth_submit_button' id='apply_api_key' href='#'
> data-sw-translate>apply</a></div>\n </div>\n</div>\n";
> },"useData":true});
> this["Handlebars"]["templates"]["basic_auth_button_view"] =
> Handlebars.template({"compiler":[6,">=
> 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
> return "<div class='auth_button' id='basic_auth_button'><img
> class='auth_icon' src='images/password.jpeg'></div>\n<div
> class='auth_container' id='basic_auth_container'>\n <div
> class='key_input_container'>\n <div class=\"auth_label\"><label
> for=\"input_username\" data-sw-translate>Username</label></div>\n <input
> placeholder=\"username\" class=\"auth_input\" id=\"input_username\"
> name=\"username\" type=\"text\"/>\n <div class=\"auth_label\"><label
> for=\"password\" data-sw-translate>Password</label></div>\n <input
> placeholder=\"password\" class=\"auth_input\" id=\"input_password\"
> name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a
> class='auth_submit_button' id=\"apply_basic_auth\"
> href=\"#\">apply</a></div>\n </div>\n</div>\n\n";
> },"useData":true});
> this["Handlebars"]["templates"]["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, helper, functionType="function",
> helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression,
> buffer = "<label data-sw-translate for=\""
> + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0
> != null ? depth0.contentTypeId : depth0)) != null ? helper :
> helperMissing),(typeof helper === functionType ? helper.call(depth0,
> {"name":"contentTypeId","hash":{},"data":data}) : helper)))
> + "\">Response Content Type</label>\n<select name=\"contentType\" id=\""
> + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0
> != null ? depth0.contentTypeId : depth0)) != null ? helper :
> helperMissing),(typeof helper === functionType ? helper.call(depth0,
> {"name":"contentTypeId","hash":{},"data":data}) : helper)))
> + "\">\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});
> 'use strict';
11d44
< dom_id: 'swagger_ui',
13,17c46
< // Attributes
< options: null,
< api: null,
< headerView: null,
< mainView: null,
---
> $(function() {
19,24c48,57
< // SwaggerUi accepts all the same options as SwaggerApi
< initialize: function(options) {
< options = options || {};
< if(!options.highlightSizeThreshold) {
< options.highlightSizeThreshold = 100000;
< }
---
> // Helper function for vertically aligning DOM elements
> // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
> $.fn.vAlign = function() {
> return this.each(function(){
> var ah = $(this).height();
> var ph = $(this).parent().height();
> var mh = (ph - ah) / 2;
> $(this).css('margin-top', mh);
> });
> };
26,30c59,66
< // Allow dom_id to be overridden
< if (options.dom_id) {
< this.dom_id = options.dom_id;
< delete options.dom_id;
< }
---
> $.fn.stretchFormtasticInputWidthToParent = function() {
> return this.each(function(){
> 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);
> });
> };
32,42c68
< if (!options.supportedSubmitMethods){
< options.supportedSubmitMethods = [
< 'get',
< 'put',
< 'post',
< 'delete',
< 'head',
< 'options',
< 'patch'
< ];
< }
---
> $('form.formtastic li.string input, form.formtastic
> textarea').stretchFormtasticInputWidthToParent();
44,46c70,72
< if (typeof options.oauth2RedirectUrl === 'string') {
< window.oAuthRedirectUrl = options.redirectUrl;
< }
---
> // Vertically center these paragraphs
> // Parent may need a min-height for this to work..
> $('ul.downplayed li div.content p').vAlign();
48,51c74,75
< // Create an empty div which contains the dom_id
< if (! $('#' + this.dom_id).length){
< $('body').append('<div id="' + this.dom_id + '"></div>') ;
< }
---
> // When a sandbox form is submitted..
> $("form.sandbox").submit(function(){
53c77
< this.options = options;
---
> var error_free = true;
55,56c79,80
< // set marked options
< marked.setOptions({gfm: true});
---
> // Cycle through the forms required inputs
> $(this).find("input.required").each(function() {
58,62c82,83
< // Set the callbacks
< var that = this;
< this.options.success = function() { return that.render(); };
< this.options.progress = function(d) { return that.showMessage(d); };
< this.options.failure = function(d) { return that.onLoadFailure(d); };
---
> // Remove any existing error styles from the input
> $(this).removeClass('error');
64,65c85,90
< // Create view to handle the header inputs
< this.headerView = new SwaggerUi.Views.HeaderView({el: $('#header')});
---
> // Tack the error style on if the input is empty..
> if ($(this).val() === '') {
> $(this).addClass('error');
> $(this).wiggle();
> error_free = false;
> }
67,71c92
< // Event handler for when the baseUrl/apiKey is entered by user
< this.headerView.on('update-swagger-ui', function(data) {
< return that.updateSwaggerUi(data);
< });
< },
---
> });
73,76c94,95
< // Set an option after initializing
< setOption: function(option, value) {
< this.options[option] = value;
< },
---
> return error_free;
> });
78,81c97
< // Get the value of a previously set option
< getOption: function(option) {
< return this.options[option];
< },
---
> });
83,87c99,100
< // Event handler for when url/key is received from user
< updateSwaggerUi: function(data){
< this.options.url = data.url;
< this.load();
< },
---
> function clippyCopiedCallback() {
> $('#api_key_copied').fadeIn().delay(1000).fadeOut();
89,103c102,107
< // Create an api and render
< load: function(){
< // Initialize the API object
< if (this.mainView) {
< this.mainView.clear();
< }
< var url = this.options.url;
< if (url && url.indexOf('http') !== 0) {
< url = this.buildUrl(window.location.href.toString(), url);
< }
< if(this.api) {
< this.options.authorizations = this.api.clientAuthorizations.authz;
< }
< this.options.url = url;
< this.headerView.update(url);
---
> // var b = $("#clippy_tooltip_" + a);
> // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"),
> setTimeout(function() {
> // b.attr("title", "copy to clipboard")
> // },
> // 500))
> }
105,106c109,116
< this.api = new SwaggerClient(this.options);
< },
---
> // Logging function that accounts for browsers that don't have window.console
> function log(){
> log.history = log.history || [];
> log.history.push(arguments);
> if(this.console){
> console.log( Array.prototype.slice.call(arguments)[0] );
> }
> }
108,111c118,125
< // collapse all sections
< collapseAll: function(){
< Docs.collapseEndpointListForResource('');
< },
---
> // 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);
> }
113,116c127
< // list operations for all sections
< listAll: function(){
< Docs.collapseOperationsForResource('');
< },
---
> window.Docs = {
118,121c129
< // expand operations for all sections
< expandAll: function(){
< Docs.expandOperationsForResource('');
< },
---
> shebang: function() {
123,142c131,134
< // This is bound to success handler for SwaggerApi
< // so it gets called when SwaggerApi completes loading
< render: function(){
< this.showMessage('Finished Loading Resource Information. Rendering
Swagger UI...');
< this.mainView = new SwaggerUi.Views.MainView({
< model: this.api,
< el: $('#' + this.dom_id),
< swaggerOptions: this.options,
< router: this
< }).render();
< this.showMessage();
< switch (this.options.docExpansion) {
< case 'full':
< this.expandAll(); break;
< case 'list':
< this.listAll(); break;
< default:
< break;
< }
< this.renderGFM();
---
> // 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
144,146c136,140
< if (this.options.onComplete){
< this.options.onComplete(this.api, this);
< }
---
> switch (fragments.length) {
> case 1:
> if (fragments[0].length > 0) { // prevent matching "#/"
> // Expand all operations for the resource and scroll to it
> var dom_id = 'resource_' + fragments[0];
148,149c142,147
< setTimeout(Docs.shebang.bind(this), 100);
< },
---
> Docs.expandEndpointListForResource(fragments[0]);
> $("#"+dom_id).slideto({highlight: false});
> }
> break;
> case 2:
> // Refer to the endpoint DOM element, e.g.
> #words_get_search
151,157c149,151
< buildUrl: function(base, url){
< if (url.indexOf('/') === 0) {
< var parts = base.split('/');
< base = parts[0] + '//' + parts[2];
< return base + url;
< } else {
< var endOfPath = base.length;
---
> // Expand Resource
> Docs.expandEndpointListForResource(fragments[0]);
> $("#"+dom_id).slideto({highlight: false});
159,161c153,155
< if (base.indexOf('?') > -1){
< endOfPath = Math.min(endOfPath, base.indexOf('?'));
< }
---
> // Expand operation
> var li_dom_id = fragments.join('_');
> var li_content_dom_id = li_dom_id + "_content";
163,165d156
< if (base.indexOf('#') > -1){
< endOfPath = Math.min(endOfPath, base.indexOf('#'));
< }
167c158,161
< base = base.substring(0, endOfPath);
---
> Docs.expandOperation($('#'+li_content_dom_id));
> $('#'+li_dom_id).slideto({highlight: false});
> break;
> }
169,171c163
< if (base.indexOf('/', base.length - 1 ) !== -1){
< return base + url;
< }
---
> },
173,175c165,172
< return base + '/' + url;
< }
< },
---
> toggleEndpointListForResource: function(resource) {
> var elem = $('li#resource_' + Docs.escapeResourceName(resource)
> + ' ul.endpoints');
> if (elem.is(':visible')) {
> Docs.collapseEndpointListForResource(resource);
> } else {
> Docs.expandEndpointListForResource(resource);
> }
> },
177,189c174,180
< // Shows message on topbar of the ui
< showMessage: function(data){
< if (data === undefined) {
< data = '';
< }
< var $msgbar = $('#message-bar');
< $msgbar.removeClass('message-fail');
< $msgbar.addClass('message-success');
< $msgbar.html(data);
< if(window.SwaggerTranslator) {
< window.SwaggerTranslator.translate($msgbar);
< }
< },
---
> // Expand resource
> expandEndpointListForResource: function(resource) {
> var resource = Docs.escapeResourceName(resource);
> if (resource == '') {
> $('.resource ul.endpoints').slideDown();
> return;
> }
191,197c182
< // shows message in red
< onLoadFailure: function(data){
< if (data === undefined) {
< data = '';
< }
< $('#message-bar').removeClass('message-success');
< $('#message-bar').addClass('message-fail');
---
> $('li#resource_' + resource).addClass('active');
199c184,186
< var val = $('#message-bar').text(data);
---
> var elem = $('li#resource_' + resource + ' ul.endpoints');
> elem.slideDown();
> },
201,203c188,194
< if (this.options.onFailure) {
< this.options.onFailure(data);
< }
---
> // Collapse resource and mark as explicitly closed
> collapseEndpointListForResource: function(resource) {
> var resource = Docs.escapeResourceName(resource);
> if (resource == '') {
> $('.resource ul.endpoints').slideUp();
> return;
> }
205,206c196
< return val;
< },
---
> $('li#resource_' + resource).removeClass('active');
208,212c198,200
< // Renders GFM for elements with 'markdown' class
< renderGFM: function(){
< $('.markdown').each(function(){
< $(this).html(marked($(this).html()));
< });
---
> var elem = $('li#resource_' + resource + ' ul.endpoints');
> elem.slideUp();
> },
214,217c202,204
< $('.propDesc', '.model-signature .description').each(function () {
< $(this).html(marked($(this).html())).addClass('markdown');
< });
< }
---
> expandOperationsForResource: function(resource) {
> // Make sure the resource container is open..
> Docs.expandEndpointListForResource(resource);
219c206,209
< });
---
> if (resource == '') {
> $('.resource ul.endpoints li.operation
> div.content').slideDown();
> return;
> }
221c211,214
< window.SwaggerUi.Views = {};
---
> $('li#resource_' + Docs.escapeResourceName(resource) + '
> li.operation div.content').each(function() {
> Docs.expandOperation($(this));
> });
> },
223,227c216,218
< // don't break backward compatibility with previous versions and warn users
to upgrade their code
< (function(){
< window.authorizations = {
< add: function() {
< warn('Using window.authorizations is deprecated. Please use
SwaggerUi.api.clientAuthorizations.add().');
---
> collapseOperationsForResource: function(resource) {
> // Make sure the resource container is open..
> Docs.expandEndpointListForResource(resource);
229,231c220,223
< if (typeof window.swaggerUi === 'undefined') {
< throw new TypeError('window.swaggerUi is not defined');
< }
---
> if (resource == '') {
> $('.resource ul.endpoints li.operation
> div.content').slideUp();
> return;
> }
233,237c225,228
< if (window.swaggerUi instanceof SwaggerUi) {
<
window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations,
arguments);
< }
< }
< };
---
> $('li#resource_' + Docs.escapeResourceName(resource) + '
> li.operation div.content').each(function() {
> Docs.collapseOperation($(this));
> });
> },
239,242c230,232
< window.ApiKeyAuthorization = function() {
< warn('window.ApiKeyAuthorization is deprecated. Please use
SwaggerClient.ApiKeyAuthorization.');
< SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
< };
---
> escapeResourceName: function(resource) {
> return
> resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
> },
244,247c234,236
< window.PasswordAuthorization = function() {
< warn('window.PasswordAuthorization is deprecated. Please use
SwaggerClient.PasswordAuthorization.');
< SwaggerClient.PasswordAuthorization.apply(window, arguments);
< };
---
> expandOperation: function(elem) {
> elem.slideDown();
> },
249,251c238,265
< function warn(message) {
< if ('console' in window && typeof window.console.warn === 'function') {
< console.warn(message);
---
> collapseOperation: function(elem) {
> elem.slideUp();
> }
> };
>
> 'use strict';
>
> Handlebars.registerHelper('sanitize', function(html) {
> // Strip the script tags from the html, and return it as a
> Handlebars.SafeString
> html =
> html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
> return new Handlebars.SafeString(html);
> });
>
> Handlebars.registerHelper('renderTextParam', function(param) {
> var result, type = 'text', idAtt = '';
> var isArray = param.type.toLowerCase() === 'array' || param.allowMultiple;
> var defaultValue = isArray && Array.isArray(param.default) ?
> param.default.join('\n') : param.default;
>
> var dataVendorExtensions = Object.keys(param).filter(function(property) {
> // filter X-data- properties
> return property.match(/^X-data-/i) !== null;
> }).reduce(function(result, property) {
> // remove X- from property name, so it results in html attributes
> like data-foo='bar'
> return result += ' ' + property.substring(2, property.length) + '=\''
> + param[property] + '\'';
> }, '');
>
> if (typeof defaultValue === 'undefined') {
> defaultValue = '';
253,254d266
< }
< })();
255a268,270
> if(param.format && param.format === 'password') {
> type = 'password';
> }
257,268c272,279
< // UMD
< (function (root, factory) {
< if (typeof define === 'function' && define.amd) {
< // AMD. Register as an anonymous module.
< define(['b'], function (b) {
< return (root.SwaggerUi = factory(b));
< });
< } else if (typeof exports === 'object') {
< // Node. Does not work with strict CommonJS, but
< // only CommonJS-like environments that support module.exports,
< // like Node.
< module.exports = factory(require('b'));
---
> if(param.valueId) {
> idAtt = ' id=\'' + param.valueId + '\'';
> }
>
> if(isArray) {
> result = '<textarea class=\'body-textarea' + (param.required ? '
> required' : '') + '\' name=\'' + param.name + '\'' + idAtt +
> dataVendorExtensions;
> result += ' placeholder=\'Provide multiple values in new lines' +
> (param.required ? ' (at least one required).' : '.') + '\'>';
> result += defaultValue + '</textarea>';
270,271c281,287
< // Browser globals
< root.SwaggerUi = factory(root.b);
---
> var parameterClass = 'parameter';
> if(param.required) {
> parameterClass += ' required';
> }
> result = '<input class=\'' + parameterClass + '\' minlength=\'' +
> (param.required ? 1 : 0) + '\'';
> result += ' name=\'' + param.name +'\' placeholder=\'' +
> (param.required ? '(required)' : '') + '\'' + idAtt + dataVendorExtensions;
> result += ' type=\'' + type + '\' value=\'' + defaultValue + '\'/>';
273,275c289,290
< }(this, function () {
< return SwaggerUi;
< }));
---
> return new Handlebars.SafeString(result);
> });
277,290c292,296
< this["Handlebars"] = this["Handlebars"] || {};
< this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
< this["Handlebars"]["templates"]["apikey_button_view"] =
Handlebars.template({"compiler":[6,">=
2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
< var helper, functionType="function", helperMissing=helpers.helperMissing,
escapeExpression=this.escapeExpression;
< return "<!--div class='auth_button' id='apikey_button'><img
class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div
class='auth_container' id='apikey_container'>\n <div
class='key_input_container'>\n <div class='auth_label'><label
for='input_apiKey_entry'>"
< + escapeExpression(((helper = (helper = helpers.keyName || (depth0 !=
null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof
helper === functionType ? helper.call(depth0,
{"name":"keyName","hash":{},"data":data}) : helper)))
< + "</label></div>\n <input placeholder='api_key' class='auth_input'
id='input_apiKey_entry' name='apiKey' type='text'/>\n <div
class='auth_submit'><a class='auth_submit_button' id='apply_api_key' href='#'
data-sw-translate>apply</a></div>\n </div>\n</div>\n";
< },"useData":true});
< this["Handlebars"]["templates"]["basic_auth_button_view"] =
Handlebars.template({"compiler":[6,">=
2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
< return "<div class='auth_button' id='basic_auth_button'><img
class='auth_icon' src='images/password.jpeg'></div>\n<div
class='auth_container' id='basic_auth_container'>\n <div
class='key_input_container'>\n <div class=\"auth_label\"><label
for=\"input_username\" data-sw-translate>Username</label></div>\n <input
placeholder=\"username\" class=\"auth_input\" id=\"input_username\"
name=\"username\" type=\"text\"/>\n <div class=\"auth_label\"><label
for=\"password\" data-sw-translate>Password</label></div>\n <input
placeholder=\"password\" class=\"auth_input\" id=\"input_password\"
name=\"password\" type=\"password\"/>\n <div class='auth_submit'><a
class='auth_submit_button' id=\"apply_basic_auth\" href=\"#\">apply</a></div>\n
</div>\n</div>\n\n";
< },"useData":true});
< this["Handlebars"]["templates"]["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});
---
> this["Handlebars"]["templates"]["main"] =
> Handlebars.template({"1":function(depth0,helpers,partials,data) {
> var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression,
> buffer = " <div class=\"info_title\">"
> + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info :
> depth0)) != null ? stack1.title : stack1), depth0))
> + "</div>\n <div class=\"info_description markdown\">";
> stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null
> ? stack1.description : stack1), depth0);
292,295c298,299
< return buffer;
< },"2":function(depth0,helpers,partials,data) {
< var stack1, lambda=this.lambda, buffer = " <option value=\"";
< stack1 = lambda(depth0, depth0);
---
> buffer += "</div>\n";
> stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.externalDocs :
> depth0), {"name":"if","hash":{},"fn":this.program(2,
> data),"inverse":this.noop,"data":data});
297,298c301,302
< buffer += "\">";
< stack1 = lambda(depth0, depth0);
---
> buffer += " ";
> stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ?
> depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1),
> {"name":"if","hash":{},"fn":this.program(4,
> data),"inverse":this.noop,"data":data});
300,575c304,305
< 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, helper, functionType="function",
helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression,
buffer = "<label data-sw-translate for=\""
< + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0
!= null ? depth0.contentTypeId : depth0)) != null ? helper :
helperMissing),(typeof helper === functionType ? helper.call(depth0,
{"name":"contentTypeId","hash":{},"data":data}) : helper)))
< + "\">Response Content Type</label>\n<select name=\"contentType\" id=\""
< + escapeExpression(((helper = (helper = helpers.contentTypeId || (depth0
!= null ? depth0.contentTypeId : depth0)) != null ? helper :
helperMissing),(typeof helper === functionType ? helper.call(depth0,
{"name":"contentTypeId","hash":{},"data":data}) : helper)))
< + "\">\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});
< 'use strict';
<
<
< $(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(){
< 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(){
< 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() {
< $('#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
< function log(){
< 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);
< }
<
< window.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:
< if (fragments[0].length > 0) { // prevent matching "#/"
< // 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);
< if (resource == '') {
< $('.resource ul.endpoints').slideUp();
< return;
< }
<
< $('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);
<
< if (resource == '') {
< $('.resource ul.endpoints li.operation
div.content').slideUp();
< return;
< }
<
< $('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();
< }
< };
<
< 'use strict';
<
< Handlebars.registerHelper('sanitize', function(html) {
< // Strip the script tags from the html, and return it as a
Handlebars.SafeString
< html =
html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
< return new Handlebars.SafeString(html);
< });
<
< Handlebars.registerHelper('renderTextParam', function(param) {
< var result, type = 'text', idAtt = '';
< var isArray = param.type.toLowerCase() === 'array' || param.allowMultiple;
< var defaultValue = isArray && Array.isArray(param.default) ?
param.default.join('\n') : param.default;
<
< var dataVendorExtensions = Object.keys(param).filter(function(property) {
< // filter X-data- properties
< return property.match(/^X-data-/i) !== null;
< }).reduce(function(result, property) {
< // remove X- from property name, so it results in html attributes
like data-foo='bar'
< return result += ' ' + property.substring(2, property.length) + '=\''
+ param[property] + '\'';
< }, '');
<
< if (typeof defaultValue === 'undefined') {
< defaultValue = '';
< }
<
< if(param.format && param.format === 'password') {
< type = 'password';
< }
<
< if(param.valueId) {
< idAtt = ' id=\'' + param.valueId + '\'';
< }
<
< if(isArray) {
< result = '<textarea class=\'body-textarea' + (param.required ? '
required' : '') + '\' name=\'' + param.name + '\'' + idAtt +
dataVendorExtensions;
< result += ' placeholder=\'Provide multiple values in new lines' +
(param.required ? ' (at least one required).' : '.') + '\'>';
< result += defaultValue + '</textarea>';
< } else {
< var parameterClass = 'parameter';
< if(param.required) {
< parameterClass += ' required';
< }
< result = '<input class=\'' + parameterClass + '\' minlength=\'' +
(param.required ? 1 : 0) + '\'';
< result += ' name=\'' + param.name +'\' placeholder=\'' +
(param.required ? '(required)' : '') + '\'' + idAtt + dataVendorExtensions;
< result += ' type=\'' + type + '\' value=\'' + defaultValue + '\'/>';
< }
< return new Handlebars.SafeString(result);
< });
<
< this["Handlebars"]["templates"]["main"] =
Handlebars.template({"1":function(depth0,helpers,partials,data) {
< var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression,
buffer = " <div class=\"info_title\">"
< + escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info :
depth0)) != null ? stack1.title : stack1), depth0))
< + "</div>\n <div class=\"info_description markdown\">";
< stack1 = lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null
? stack1.description : stack1), depth0);
< if (stack1 != null) { buffer += stack1; }
< buffer += "</div>\n";
< stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.externalDocs :
depth0), {"name":"if","hash":{},"fn":this.program(2,
data),"inverse":this.noop,"data":data});
< if (stack1 != null) { buffer += stack1; }
< buffer += " ";
< stack1 = helpers['if'].call(depth0, ((stack1 = (depth0 != null ?
depth0.info : depth0)) != null ? stack1.termsOfServiceUrl : stack1),
{"name":"if","hash":{},"fn":this.program(4,
data),"inverse":this.noop,"data":data});
< if (stack1 != null) { buffer += stack1; }
< buffer += "\n ";
< stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ?
depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ?
stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(6,
data),"inverse":this.noop,"data":data});
---
> buffer += "\n ";
> stack1 = helpers['if'].call(depth0, ((stack1 = ((stack1 = (depth0 != null ?
> depth0.info : depth0)) != null ? stack1.contact : stack1)) != null ?
> stack1.name : stack1), {"name":"if","hash":{},"fn":this.program(6,
> data),"inverse":this.noop,"data":data});
765,825d494
< this["Handlebars"]["templates"]["param"] =
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});
< if (stack1 != null) { buffer += stack1; }
< return buffer;
< },"2":function(depth0,helpers,partials,data) {
< var helper, functionType="function", helperMissing=helpers.helperMissing,
escapeExpression=this.escapeExpression;
< return " <input type=\"file\" 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)))
< + "' id='"
< + escapeExpression(((helper = (helper = helpers.valueId || (depth0 !=
null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof
helper === functionType ? helper.call(depth0,
{"name":"valueId","hash":{},"data":data}) : helper)))
< + "'/>\n <div class=\"parameter-content-type\" />\n";
< },"4":function(depth0,helpers,partials,data) {
< var stack1, buffer = "";
< stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] :
depth0), {"name":"if","hash":{},"fn":this.program(5,
data),"inverse":this.program(7, data),"data":data});
< if (stack1 != null) { buffer += stack1; }
< return buffer;
< },"5":function(depth0,helpers,partials,data) {
< var helper, functionType="function", helperMissing=helpers.helperMissing,
escapeExpression=this.escapeExpression;
< return " <textarea class='body-textarea' 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)))
< + "' id='"
< + escapeExpression(((helper = (helper = helpers.valueId || (depth0 !=
null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof
helper === functionType ? helper.call(depth0,
{"name":"valueId","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 <br />\n <div
class=\"parameter-content-type\" />\n";
< },"7":function(depth0,helpers,partials,data) {
< var helper, functionType="function", helperMissing=helpers.helperMissing,
escapeExpression=this.escapeExpression;
< return " <textarea class='body-textarea' 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)))
< + "' id='"
< + escapeExpression(((helper = (helper = helpers.valueId || (depth0 !=
null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof
helper === functionType ? helper.call(depth0,
{"name":"valueId","hash":{},"data":data}) : helper)))
< + "'></textarea>\n <br />\n
<div class=\"parameter-content-type\" />\n";
< },"9":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(10, data),"data":data});
< if (stack1 != null) { buffer += stack1; }
< return buffer;
< },"10":function(depth0,helpers,partials,data) {
< var stack1, helperMissing=helpers.helperMissing, buffer = "";
< stack1 = ((helpers.renderTextParam || (depth0 && depth0.renderTextParam) ||
helperMissing).call(depth0, depth0,
{"name":"renderTextParam","hash":{},"fn":this.program(11,
data),"inverse":this.noop,"data":data}));
< if (stack1 != null) { buffer += stack1; }
< return buffer;
< },"11":function(depth0,helpers,partials,data) {
< return "";
< },"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'><label for='"
< + escapeExpression(((helper = (helper = helpers.valueId || (depth0 !=
null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof
helper === functionType ? helper.call(depth0,
{"name":"valueId","hash":{},"data":data}) : helper)))
< + "'>"
< + 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)))
< + "</label></td>\n<td>\n\n";
< stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody :
depth0), {"name":"if","hash":{},"fn":this.program(1,
data),"inverse":this.program(9, data),"data":data});
< if (stack1 != null) { buffer += stack1; }
< buffer += "\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>\n <span
class=\"model-signature\"></span>\n</td>\n";
< },"useData":true});
895c564
< this["Handlebars"]["templates"]["param_readonly"] =
Handlebars.template({"1":function(depth0,helpers,partials,data) {
---
> this["Handlebars"]["templates"]["param_readonly_required"] =
> Handlebars.template({"1":function(depth0,helpers,partials,data) {
897c566
< return " <textarea class='body-textarea' readonly='readonly' name='"
---
> return " <textarea class='body-textarea' readonly='readonly'
> placeholder='(required)' name='"
917c586
< var stack1, helper, functionType="function",
helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression,
buffer = "<td class='code'><label for='"
---
> var stack1, helper, functionType="function",
> helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression,
> buffer = "<td class='code required'><label for='"
932c601
< 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) {
934c603
< return " <textarea class='body-textarea' readonly='readonly'
placeholder='(required)' name='"
---
> return " <textarea class='body-textarea' readonly='readonly' name='"
954c623
< var stack1, helper, functionType="function",
helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression,
buffer = "<td class='code required'><label for='"
---
> var stack1, helper, functionType="function",
> helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression,
> buffer = "<td class='code'><label for='"
1036a706,766
> this["Handlebars"]["templates"]["param"] =
> 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});
> if (stack1 != null) { buffer += stack1; }
> return buffer;
> },"2":function(depth0,helpers,partials,data) {
> var helper, functionType="function", helperMissing=helpers.helperMissing,
> escapeExpression=this.escapeExpression;
> return " <input type=\"file\" 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)))
> + "' id='"
> + escapeExpression(((helper = (helper = helpers.valueId || (depth0 !=
> null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof
> helper === functionType ? helper.call(depth0,
> {"name":"valueId","hash":{},"data":data}) : helper)))
> + "'/>\n <div class=\"parameter-content-type\" />\n";
> },"4":function(depth0,helpers,partials,data) {
> var stack1, buffer = "";
> stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] :
> depth0), {"name":"if","hash":{},"fn":this.program(5,
> data),"inverse":this.program(7, data),"data":data});
> if (stack1 != null) { buffer += stack1; }
> return buffer;
> },"5":function(depth0,helpers,partials,data) {
> var helper, functionType="function", helperMissing=helpers.helperMissing,
> escapeExpression=this.escapeExpression;
> return " <textarea class='body-textarea' 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)))
> + "' id='"
> + escapeExpression(((helper = (helper = helpers.valueId || (depth0 !=
> null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof
> helper === functionType ? helper.call(depth0,
> {"name":"valueId","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 <br />\n <div
> class=\"parameter-content-type\" />\n";
> },"7":function(depth0,helpers,partials,data) {
> var helper, functionType="function", helperMissing=helpers.helperMissing,
> escapeExpression=this.escapeExpression;
> return " <textarea class='body-textarea' 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)))
> + "' id='"
> + escapeExpression(((helper = (helper = helpers.valueId || (depth0 !=
> null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof
> helper === functionType ? helper.call(depth0,
> {"name":"valueId","hash":{},"data":data}) : helper)))
> + "'></textarea>\n <br />\n
> <div class=\"parameter-content-type\" />\n";
> },"9":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(10, data),"data":data});
> if (stack1 != null) { buffer += stack1; }
> return buffer;
> },"10":function(depth0,helpers,partials,data) {
> var stack1, helperMissing=helpers.helperMissing, buffer = "";
> stack1 = ((helpers.renderTextParam || (depth0 && depth0.renderTextParam) ||
> helperMissing).call(depth0, depth0,
> {"name":"renderTextParam","hash":{},"fn":this.program(11,
> data),"inverse":this.noop,"data":data}));
> if (stack1 != null) { buffer += stack1; }
> return buffer;
> },"11":function(depth0,helpers,partials,data) {
> return "";
> },"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'><label for='"
> + escapeExpression(((helper = (helper = helpers.valueId || (depth0 !=
> null ? depth0.valueId : depth0)) != null ? helper : helperMissing),(typeof
> helper === functionType ? helper.call(depth0,
> {"name":"valueId","hash":{},"data":data}) : helper)))
> + "'>"
> + 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)))
> + "</label></td>\n<td>\n\n";
> stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody :
> depth0), {"name":"if","hash":{},"fn":this.program(1,
> data),"inverse":this.program(9, data),"data":data});
> if (stack1 != null) { buffer += stack1; }
> buffer += "\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>\n <span
> class=\"model-signature\"></span>\n</td>\n";
> },"useData":true});
1283,1289c1013
< var urlSplitPath = obj.url.split("/*");
< if(urlSplitPath.length > 1){
< obj.url=urlSplitPath[0]+urlSplitPath[1];
< }else{
< obj.url = urlSplitPath[0];
< }
< if (this.type === 'query') {
---
> if (this.type === 'query') {
30880a30605,30874
>
> 'use strict';
>
> window.SwaggerUi = Backbone.Router.extend({
>
> dom_id: 'swagger_ui',
>
> // Attributes
> options: null,
> api: null,
> headerView: null,
> mainView: null,
>
> // SwaggerUi accepts all the same options as SwaggerApi
> initialize: function(options) {
> options = options || {};
> if(!options.highlightSizeThreshold) {
> options.highlightSizeThreshold = 100000;
> }
>
> // Allow dom_id to be overridden
> if (options.dom_id) {
> this.dom_id = options.dom_id;
> delete options.dom_id;
> }
>
> if (!options.supportedSubmitMethods){
> options.supportedSubmitMethods = [
> 'get',
> 'put',
> 'post',
> 'delete',
> 'head',
> 'options',
> 'patch'
> ];
> }
>
> if (typeof options.oauth2RedirectUrl === 'string') {
> window.oAuthRedirectUrl = options.redirectUrl;
> }
>
> // Create an empty div which contains the dom_id
> if (! $('#' + this.dom_id).length){
> $('body').append('<div id="' + this.dom_id + '"></div>') ;
> }
>
> this.options = options;
>
> // set marked options
> marked.setOptions({gfm: true});
>
> // Set the callbacks
> var that = this;
> this.options.success = function() { return that.render(); };
> this.options.progress = function(d) { return that.showMessage(d); };
> this.options.failure = function(d) { return that.onLoadFailure(d); };
>
> // Create view to handle the header inputs
> this.headerView = new SwaggerUi.Views.HeaderView({el: $('#header')});
>
> // Event handler for when the baseUrl/apiKey is entered by user
> this.headerView.on('update-swagger-ui', function(data) {
> return that.updateSwaggerUi(data);
> });
> },
>
> // Set an option after initializing
> setOption: function(option, value) {
> this.options[option] = value;
> },
>
> // Get the value of a previously set option
> getOption: function(option) {
> return this.options[option];
> },
>
> // Event handler for when url/key is received from user
> updateSwaggerUi: function(data){
> this.options.url = data.url;
> this.load();
> },
>
> // Create an api and render
> load: function(){
> // Initialize the API object
> if (this.mainView) {
> this.mainView.clear();
> }
> var url = this.options.url;
> if (url && url.indexOf('http') !== 0) {
> url = this.buildUrl(window.location.href.toString(), url);
> }
> if(this.api) {
> this.options.authorizations = this.api.clientAuthorizations.authz;
> }
> this.options.url = url;
> this.headerView.update(url);
>
> this.api = new SwaggerClient(this.options);
> },
>
> // collapse all sections
> collapseAll: function(){
> Docs.collapseEndpointListForResource('');
> },
>
> // list operations for all sections
> listAll: function(){
> Docs.collapseOperationsForResource('');
> },
>
> // expand operations for all sections
> expandAll: function(){
> Docs.expandOperationsForResource('');
> },
>
> // This is bound to success handler for SwaggerApi
> // so it gets called when SwaggerApi completes loading
> render: function(){
> this.showMessage('Finished Loading Resource Information. Rendering
> Swagger UI...');
> this.mainView = new SwaggerUi.Views.MainView({
> model: this.api,
> el: $('#' + this.dom_id),
> swaggerOptions: this.options,
> router: this
> }).render();
> this.showMessage();
> switch (this.options.docExpansion) {
> case 'full':
> this.expandAll(); break;
> case 'list':
> this.listAll(); break;
> default:
> break;
> }
> this.renderGFM();
>
> if (this.options.onComplete){
> this.options.onComplete(this.api, this);
> }
>
> setTimeout(Docs.shebang.bind(this), 100);
> },
>
> buildUrl: function(base, url){
> if (url.indexOf('/') === 0) {
> var parts = base.split('/');
> base = parts[0] + '//' + parts[2];
> return base + url;
> } else {
> var 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;
> }
> },
>
> // Shows message on topbar of the ui
> showMessage: function(data){
> if (data === undefined) {
> data = '';
> }
> var $msgbar = $('#message-bar');
> $msgbar.removeClass('message-fail');
> $msgbar.addClass('message-success');
> $msgbar.html(data);
> if(window.SwaggerTranslator) {
> window.SwaggerTranslator.translate($msgbar);
> }
> },
>
> // shows message in red
> onLoadFailure: function(data){
> if (data === undefined) {
> data = '';
> }
> $('#message-bar').removeClass('message-success');
> $('#message-bar').addClass('message-fail');
>
> var val = $('#message-bar').text(data);
>
> if (this.options.onFailure) {
> this.options.onFailure(data);
> }
>
> return val;
> },
>
> // Renders GFM for elements with 'markdown' class
> renderGFM: function(){
> $('.markdown').each(function(){
> $(this).html(marked($(this).html()));
> });
>
> $('.propDesc', '.model-signature .description').each(function () {
> $(this).html(marked($(this).html())).addClass('markdown');
> });
> }
>
> });
>
> window.SwaggerUi.Views = {};
>
> // don't break backward compatibility with previous versions and warn users
> to upgrade their code
> (function(){
> window.authorizations = {
> add: function() {
> warn('Using window.authorizations is deprecated. Please use
> SwaggerUi.api.clientAuthorizations.add().');
>
> if (typeof window.swaggerUi === 'undefined') {
> throw new TypeError('window.swaggerUi is not defined');
> }
>
> if (window.swaggerUi instanceof SwaggerUi) {
>
> window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations,
> arguments);
> }
> }
> };
>
> window.ApiKeyAuthorization = function() {
> warn('window.ApiKeyAuthorization is deprecated. Please use
> SwaggerClient.ApiKeyAuthorization.');
> SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
> };
>
> window.PasswordAuthorization = function() {
> warn('window.PasswordAuthorization is deprecated. Please use
> SwaggerClient.PasswordAuthorization.');
> SwaggerClient.PasswordAuthorization.apply(window, arguments);
> };
>
> function warn(message) {
> if ('console' in window && typeof window.console.warn === 'function') {
> console.warn(message);
> }
> }
> })();
>
>
> // UMD
> (function (root, factory) {
> if (typeof define === 'function' && define.amd) {
> // AMD. Register as an anonymous module.
> define(['b'], function (b) {
> return (root.SwaggerUi = factory(b));
> });
> } else if (typeof exports === 'object') {
> // Node. Does not work with strict CommonJS, but
> // only CommonJS-like environments that support module.exports,
> // like Node.
> module.exports = factory(require('b'));
> } else {
> // Browser globals
> root.SwaggerUi = factory(root.b);
> }
> }(this, function () {
> return SwaggerUi;
> }));
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev