swagger-ui_rails 0.1.7 → 2.1.0.alpha.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -2
  3. data/Rakefile +45 -0
  4. data/app/assets/images/explorer_icons.png +0 -0
  5. data/app/assets/javascripts/swagger-oauth.js +211 -0
  6. data/app/assets/javascripts/swagger-ui/index.js +13 -0
  7. data/app/assets/javascripts/{lib → swagger-ui/lib}/backbone-min.js +0 -0
  8. data/app/assets/javascripts/{lib → swagger-ui/lib}/handlebars-1.0.0.js +0 -0
  9. data/app/assets/javascripts/{lib → swagger-ui/lib}/highlight.7.3.pack.js +0 -0
  10. data/app/assets/javascripts/{lib → swagger-ui/lib}/jquery-1.8.0.min.js +0 -0
  11. data/app/assets/javascripts/{lib → swagger-ui/lib}/jquery.ba-bbq.min.js +0 -0
  12. data/app/assets/javascripts/{lib → swagger-ui/lib}/jquery.slideto.min.js +0 -0
  13. data/app/assets/javascripts/{lib → swagger-ui/lib}/jquery.wiggle.min.js +0 -0
  14. data/app/assets/javascripts/{lib → swagger-ui/lib}/shred.bundle.js +3 -3
  15. data/app/assets/javascripts/swagger-ui/lib/swagger-client.js +1606 -0
  16. data/app/assets/javascripts/swagger-ui/lib/swagger.js +1725 -0
  17. data/app/assets/javascripts/{lib → swagger-ui/lib}/underscore-min.js +0 -0
  18. data/app/assets/javascripts/swagger-ui/swagger-oauth.js +237 -0
  19. data/app/assets/javascripts/{swagger-ui.js.erb → swagger-ui/swagger-ui.js.erb} +1076 -520
  20. data/app/assets/stylesheets/swagger-ui/index.css +5 -0
  21. data/app/assets/stylesheets/swagger-ui/reset.css +125 -0
  22. data/app/assets/stylesheets/swagger-ui/screen.css +1224 -0
  23. data/app/views/swagger_ui/_swagger_ui.html.erb +1 -1
  24. data/lib/swagger-ui_rails/engine.rb +12 -2
  25. data/lib/swagger-ui_rails/version.rb +1 -1
  26. metadata +29 -28
  27. data/.gitignore +0 -17
  28. data/Gemfile +0 -4
  29. data/app/assets/javascripts/lib/shred/content.js +0 -193
  30. data/app/assets/javascripts/lib/swagger.js +0 -1480
  31. data/app/assets/stylesheets/hightlight.default.css +0 -135
  32. data/app/assets/stylesheets/screen.css +0 -1070
  33. data/app/assets/stylesheets/swagger-ui.css +0 -4
  34. data/swagger-ui_rails.gemspec +0 -23
@@ -0,0 +1,237 @@
1
+ var appName;
2
+ var popupMask;
3
+ var popupDialog;
4
+ var clientId;
5
+ var realm;
6
+
7
+ function handleLogin() {
8
+ var scopes = [];
9
+
10
+ var auths = window.swaggerUi.api.authSchemes || window.swaggerUi.api.securityDefinitions;
11
+ if(auths) {
12
+ var key;
13
+ var defs = auths;
14
+ for(key in defs) {
15
+ var auth = defs[key];
16
+ if(auth.type === 'oauth2' && auth.scopes) {
17
+ var scope;
18
+ if(Array.isArray(auth.scopes)) {
19
+ // 1.2 support
20
+ var i;
21
+ for(i = 0; i < auth.scopes.length; i++) {
22
+ scopes.push(auth.scopes[i]);
23
+ }
24
+ }
25
+ else {
26
+ // 2.0 support
27
+ for(scope in auth.scopes) {
28
+ scopes.push({scope: scope, description: auth.scopes[scope]});
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
34
+
35
+ if(window.swaggerUi.api
36
+ && window.swaggerUi.api.info) {
37
+ appName = window.swaggerUi.api.info.title;
38
+ }
39
+
40
+ popupDialog = $(
41
+ [
42
+ '<div class="api-popup-dialog">',
43
+ '<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
44
+ '<div class="api-popup-content">',
45
+ '<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
46
+ '<a href="#">Learn how to use</a>',
47
+ '</p>',
48
+ '<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
49
+ '<ul class="api-popup-scopes">',
50
+ '</ul>',
51
+ '<p class="error-msg"></p>',
52
+ '<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
53
+ '</div>',
54
+ '</div>'].join(''));
55
+ $(document.body).append(popupDialog);
56
+
57
+ popup = popupDialog.find('ul.api-popup-scopes').empty();
58
+ for (i = 0; i < scopes.length; i ++) {
59
+ scope = scopes[i];
60
+ str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
61
+ if (scope.description) {
62
+ str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
63
+ }
64
+ str += '</label></li>';
65
+ popup.append(str);
66
+ }
67
+
68
+ var $win = $(window),
69
+ dw = $win.width(),
70
+ dh = $win.height(),
71
+ st = $win.scrollTop(),
72
+ dlgWd = popupDialog.outerWidth(),
73
+ dlgHt = popupDialog.outerHeight(),
74
+ top = (dh -dlgHt)/2 + st,
75
+ left = (dw - dlgWd)/2;
76
+
77
+ popupDialog.css({
78
+ top: (top < 0? 0 : top) + 'px',
79
+ left: (left < 0? 0 : left) + 'px'
80
+ });
81
+
82
+ popupDialog.find('button.api-popup-cancel').click(function() {
83
+ popupMask.hide();
84
+ popupDialog.hide();
85
+ popupDialog.empty();
86
+ popupDialog = [];
87
+ });
88
+
89
+ popupDialog.find('button.api-popup-authbtn').click(function() {
90
+ popupMask.hide();
91
+ popupDialog.hide();
92
+
93
+ var authSchemes = window.swaggerUi.api.authSchemes;
94
+ var host = window.location;
95
+ var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
96
+ var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
97
+ var url = null;
98
+
99
+ for (var key in authSchemes) {
100
+ if (authSchemes.hasOwnProperty(key)) {
101
+ if(authSchemes[key].type === 'oauth2' && authSchemes[key].flow === 'implicit') {
102
+ var dets = authSchemes[key];
103
+ url = dets.authorizationUrl + '?response_type=token';
104
+ window.swaggerUi.tokenName = dets.tokenUrl || 'access_token';
105
+ }
106
+ else if(authSchemes[key].grantTypes) {
107
+ // 1.2 support
108
+ var o = authSchemes[key].grantTypes;
109
+ for(var t in o) {
110
+ if(o.hasOwnProperty(t) && t === 'implicit') {
111
+ var dets = o[t];
112
+ var ep = dets.loginEndpoint.url;
113
+ url = dets.loginEndpoint.url + '?response_type=token';
114
+ window.swaggerUi.tokenName = dets.tokenName;
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+ var scopes = []
121
+ var o = $('.api-popup-scopes').find('input:checked');
122
+
123
+ for(k =0; k < o.length; k++) {
124
+ scopes.push($(o[k]).attr('scope'));
125
+ }
126
+
127
+ window.enabledScopes=scopes;
128
+
129
+ url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
130
+ url += '&realm=' + encodeURIComponent(realm);
131
+ url += '&client_id=' + encodeURIComponent(clientId);
132
+ url += '&scope=' + encodeURIComponent(scopes);
133
+
134
+ window.open(url);
135
+ });
136
+
137
+ popupMask.show();
138
+ popupDialog.show();
139
+ return;
140
+ }
141
+
142
+
143
+ function handleLogout() {
144
+ for(key in window.authorizations.authz){
145
+ window.authorizations.remove(key)
146
+ }
147
+ window.enabledScopes = null;
148
+ $('.api-ic.ic-on').addClass('ic-off');
149
+ $('.api-ic.ic-on').removeClass('ic-on');
150
+
151
+ // set the info box
152
+ $('.api-ic.ic-warning').addClass('ic-error');
153
+ $('.api-ic.ic-warning').removeClass('ic-warning');
154
+ }
155
+
156
+ function initOAuth(opts) {
157
+ var o = (opts||{});
158
+ var errors = [];
159
+
160
+ appName = (o.appName||errors.push('missing appName'));
161
+ popupMask = (o.popupMask||$('#api-common-mask'));
162
+ popupDialog = (o.popupDialog||$('.api-popup-dialog'));
163
+ clientId = (o.clientId||errors.push('missing client id'));
164
+ realm = (o.realm||errors.push('missing realm'));
165
+
166
+ if(errors.length > 0){
167
+ log('auth unable initialize oauth: ' + errors);
168
+ return;
169
+ }
170
+
171
+ $('pre code').each(function(i, e) {hljs.highlightBlock(e)});
172
+ $('.api-ic').click(function(s) {
173
+ if($(s.target).hasClass('ic-off'))
174
+ handleLogin();
175
+ else {
176
+ handleLogout();
177
+ }
178
+ false;
179
+ });
180
+ }
181
+
182
+ function onOAuthComplete(token) {
183
+ if(token) {
184
+ if(token.error) {
185
+ var checkbox = $('input[type=checkbox],.secured')
186
+ checkbox.each(function(pos){
187
+ checkbox[pos].checked = false;
188
+ });
189
+ alert(token.error);
190
+ }
191
+ else {
192
+ var b = token[window.swaggerUi.tokenName];
193
+ if(b){
194
+ // if all roles are satisfied
195
+ var o = null;
196
+ $.each($('.auth #api_information_panel'), function(k, v) {
197
+ var children = v;
198
+ if(children && children.childNodes) {
199
+ var requiredScopes = [];
200
+ $.each((children.childNodes), function (k1, v1){
201
+ var inner = v1.innerHTML;
202
+ if(inner)
203
+ requiredScopes.push(inner);
204
+ });
205
+ var diff = [];
206
+ for(var i=0; i < requiredScopes.length; i++) {
207
+ var s = requiredScopes[i];
208
+ if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) {
209
+ diff.push(s);
210
+ }
211
+ }
212
+ if(diff.length > 0){
213
+ o = v.parentNode;
214
+ $(o.parentNode).find('.api-ic.ic-on').addClass('ic-off');
215
+ $(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on');
216
+
217
+ // sorry, not all scopes are satisfied
218
+ $(o).find('.api-ic').addClass('ic-warning');
219
+ $(o).find('.api-ic').removeClass('ic-error');
220
+ }
221
+ else {
222
+ o = v.parentNode;
223
+ $(o.parentNode).find('.api-ic.ic-off').addClass('ic-on');
224
+ $(o.parentNode).find('.api-ic.ic-off').removeClass('ic-off');
225
+
226
+ // all scopes are satisfied
227
+ $(o).find('.api-ic').addClass('ic-info');
228
+ $(o).find('.api-ic').removeClass('ic-warning');
229
+ $(o).find('.api-ic').removeClass('ic-error');
230
+ }
231
+ }
232
+ });
233
+ window.authorizations.add('oauth2', new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
234
+ }
235
+ }
236
+ }
237
+ }
@@ -1,199 +1,217 @@
1
- //= require lib/shred.bundle.js
2
- //= require lib/jquery-1.8.0.min.js
3
- //= require lib/jquery.slideto.min.js
4
- //= require lib/jquery.wiggle.min.js
5
- //= require lib/jquery.ba-bbq.min.js
6
- //= require lib/handlebars-1.0.0.js
7
- //= require lib/underscore-min.js
8
- //= require lib/backbone-min.js
9
- //= require lib/swagger.js
10
- //= require_self
11
- //= require lib/highlight.7.3.pack.js
12
-
13
- $(function() {
14
-
15
- // Helper function for vertically aligning DOM elements
16
- // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
17
- $.fn.vAlign = function() {
18
- return this.each(function(i){
19
- var ah = $(this).height();
20
- var ph = $(this).parent().height();
21
- var mh = (ph - ah) / 2;
22
- $(this).css('margin-top', mh);
23
- });
24
- };
25
-
26
- $.fn.stretchFormtasticInputWidthToParent = function() {
27
- return this.each(function(i){
28
- var p_width = $(this).closest("form").innerWidth();
29
- var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
30
- var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
31
- $(this).css('width', p_width - p_padding - this_padding);
32
- });
33
- };
34
-
35
- $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
36
-
37
- // Vertically center these paragraphs
38
- // Parent may need a min-height for this to work..
39
- $('ul.downplayed li div.content p').vAlign();
40
-
41
- // When a sandbox form is submitted..
42
- $("form.sandbox").submit(function(){
43
-
44
- var error_free = true;
45
-
46
- // Cycle through the forms required inputs
47
- $(this).find("input.required").each(function() {
48
-
49
- // Remove any existing error styles from the input
50
- $(this).removeClass('error');
51
-
52
- // Tack the error style on if the input is empty..
53
- if ($(this).val() == '') {
54
- $(this).addClass('error');
55
- $(this).wiggle();
56
- error_free = false;
57
- }
58
-
59
- });
60
-
61
- return error_free;
62
- });
63
-
64
- });
65
-
66
- function clippyCopiedCallback(a) {
67
- $('#api_key_copied').fadeIn().delay(1000).fadeOut();
68
-
69
- // var b = $("#clippy_tooltip_" + a);
70
- // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
71
- // b.attr("title", "copy to clipboard")
72
- // },
73
- // 500))
74
- }
75
-
76
- // Logging function that accounts for browsers that don't have window.console
77
- function log() {
78
- if (window.console) console.log.apply(console,arguments);
79
- }
80
- // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
81
- if (Function.prototype.bind && console && typeof console.log == "object") {
82
- [
83
- "log","info","warn","error","assert","dir","clear","profile","profileEnd"
84
- ].forEach(function (method) {
85
- console[method] = this.bind(console[method], console);
86
- }, Function.prototype.call);
87
- }
88
-
89
- var Docs = {
90
-
91
- shebang: function() {
92
-
93
- // If shebang has an operation nickname in it..
94
- // e.g. /docs/#!/words/get_search
95
- var fragments = $.param.fragment().split('/');
96
- fragments.shift(); // get rid of the bang
97
-
98
- switch (fragments.length) {
99
- case 1:
100
- // Expand all operations for the resource and scroll to it
101
- // log('shebang resource:' + fragments[0]);
102
- var dom_id = 'resource_' + fragments[0];
103
-
104
- Docs.expandEndpointListForResource(fragments[0]);
105
- $("#"+dom_id).slideto({highlight: false});
106
- break;
107
- case 2:
108
- // Refer to the endpoint DOM element, e.g. #words_get_search
109
- // log('shebang endpoint: ' + fragments.join('_'));
110
-
111
- // Expand Resource
112
- Docs.expandEndpointListForResource(fragments[0]);
113
- $("#"+dom_id).slideto({highlight: false});
114
-
115
- // Expand operation
116
- var li_dom_id = fragments.join('_');
117
- var li_content_dom_id = li_dom_id + "_content";
118
-
119
- // log("li_dom_id " + li_dom_id);
120
- // log("li_content_dom_id " + li_content_dom_id);
121
-
122
- Docs.expandOperation($('#'+li_content_dom_id));
123
- $('#'+li_dom_id).slideto({highlight: false});
124
- break;
125
- }
126
-
127
- },
128
-
129
- toggleEndpointListForResource: function(resource) {
130
- var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
131
- if (elem.is(':visible')) {
132
- Docs.collapseEndpointListForResource(resource);
133
- } else {
134
- Docs.expandEndpointListForResource(resource);
135
- }
136
- },
137
-
138
- // Expand resource
139
- expandEndpointListForResource: function(resource) {
140
- var resource = Docs.escapeResourceName(resource);
141
- if (resource == '') {
142
- $('.resource ul.endpoints').slideDown();
143
- return;
144
- }
145
-
146
- $('li#resource_' + resource).addClass('active');
147
-
148
- var elem = $('li#resource_' + resource + ' ul.endpoints');
149
- elem.slideDown();
150
- },
151
-
152
- // Collapse resource and mark as explicitly closed
153
- collapseEndpointListForResource: function(resource) {
154
- var resource = Docs.escapeResourceName(resource);
155
- $('li#resource_' + resource).removeClass('active');
156
-
157
- var elem = $('li#resource_' + resource + ' ul.endpoints');
158
- elem.slideUp();
159
- },
160
-
161
- expandOperationsForResource: function(resource) {
162
- // Make sure the resource container is open..
163
- Docs.expandEndpointListForResource(resource);
164
-
165
- if (resource == '') {
166
- $('.resource ul.endpoints li.operation div.content').slideDown();
167
- return;
168
- }
169
-
170
- $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
171
- Docs.expandOperation($(this));
172
- });
173
- },
1
+ // swagger-ui.js
2
+ // version 2.1.0-alpha.7
3
+ $(function() {
4
+
5
+ // Helper function for vertically aligning DOM elements
6
+ // http://www.seodenver.com/simple-vertical-align-plugin-for-jquery/
7
+ $.fn.vAlign = function() {
8
+ return this.each(function(i){
9
+ var ah = $(this).height();
10
+ var ph = $(this).parent().height();
11
+ var mh = (ph - ah) / 2;
12
+ $(this).css('margin-top', mh);
13
+ });
14
+ };
15
+
16
+ $.fn.stretchFormtasticInputWidthToParent = function() {
17
+ return this.each(function(i){
18
+ var p_width = $(this).closest("form").innerWidth();
19
+ var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
20
+ var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
21
+ $(this).css('width', p_width - p_padding - this_padding);
22
+ });
23
+ };
24
+
25
+ $('form.formtastic li.string input, form.formtastic textarea').stretchFormtasticInputWidthToParent();
26
+
27
+ // Vertically center these paragraphs
28
+ // Parent may need a min-height for this to work..
29
+ $('ul.downplayed li div.content p').vAlign();
30
+
31
+ // When a sandbox form is submitted..
32
+ $("form.sandbox").submit(function(){
33
+
34
+ var error_free = true;
35
+
36
+ // Cycle through the forms required inputs
37
+ $(this).find("input.required").each(function() {
38
+
39
+ // Remove any existing error styles from the input
40
+ $(this).removeClass('error');
41
+
42
+ // Tack the error style on if the input is empty..
43
+ if ($(this).val() == '') {
44
+ $(this).addClass('error');
45
+ $(this).wiggle();
46
+ error_free = false;
47
+ }
48
+
49
+ });
50
+
51
+ return error_free;
52
+ });
53
+
54
+ });
55
+
56
+ function clippyCopiedCallback(a) {
57
+ $('#api_key_copied').fadeIn().delay(1000).fadeOut();
58
+
59
+ // var b = $("#clippy_tooltip_" + a);
60
+ // b.length != 0 && (b.attr("title", "copied!").trigger("tipsy.reload"), setTimeout(function() {
61
+ // b.attr("title", "copy to clipboard")
62
+ // },
63
+ // 500))
64
+ }
65
+
66
+ // Logging function that accounts for browsers that don't have window.console
67
+ log = function(){
68
+ log.history = log.history || [];
69
+ log.history.push(arguments);
70
+ if(this.console){
71
+ console.log( Array.prototype.slice.call(arguments)[0] );
72
+ }
73
+ };
74
+
75
+ // Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
76
+ if (Function.prototype.bind && console && typeof console.log == "object") {
77
+ [
78
+ "log","info","warn","error","assert","dir","clear","profile","profileEnd"
79
+ ].forEach(function (method) {
80
+ console[method] = this.bind(console[method], console);
81
+ }, Function.prototype.call);
82
+ }
83
+
84
+ var Docs = {
85
+
86
+ shebang: function() {
87
+
88
+ // If shebang has an operation nickname in it..
89
+ // e.g. /docs/#!/words/get_search
90
+ var fragments = $.param.fragment().split('/');
91
+ fragments.shift(); // get rid of the bang
92
+
93
+ switch (fragments.length) {
94
+ case 1:
95
+ // Expand all operations for the resource and scroll to it
96
+ var dom_id = 'resource_' + fragments[0];
97
+
98
+ Docs.expandEndpointListForResource(fragments[0]);
99
+ $("#"+dom_id).slideto({highlight: false});
100
+ break;
101
+ case 2:
102
+ // Refer to the endpoint DOM element, e.g. #words_get_search
103
+
104
+ // Expand Resource
105
+ Docs.expandEndpointListForResource(fragments[0]);
106
+ $("#"+dom_id).slideto({highlight: false});
107
+
108
+ // Expand operation
109
+ var li_dom_id = fragments.join('_');
110
+ var li_content_dom_id = li_dom_id + "_content";
111
+
112
+
113
+ Docs.expandOperation($('#'+li_content_dom_id));
114
+ $('#'+li_dom_id).slideto({highlight: false});
115
+ break;
116
+ }
117
+
118
+ },
119
+
120
+ toggleEndpointListForResource: function(resource) {
121
+ var elem = $('li#resource_' + Docs.escapeResourceName(resource) + ' ul.endpoints');
122
+ if (elem.is(':visible')) {
123
+ Docs.collapseEndpointListForResource(resource);
124
+ } else {
125
+ Docs.expandEndpointListForResource(resource);
126
+ }
127
+ },
128
+
129
+ // Expand resource
130
+ expandEndpointListForResource: function(resource) {
131
+ var resource = Docs.escapeResourceName(resource);
132
+ if (resource == '') {
133
+ $('.resource ul.endpoints').slideDown();
134
+ return;
135
+ }
136
+
137
+ $('li#resource_' + resource).addClass('active');
138
+
139
+ var elem = $('li#resource_' + resource + ' ul.endpoints');
140
+ elem.slideDown();
141
+ },
142
+
143
+ // Collapse resource and mark as explicitly closed
144
+ collapseEndpointListForResource: function(resource) {
145
+ var resource = Docs.escapeResourceName(resource);
146
+ $('li#resource_' + resource).removeClass('active');
147
+
148
+ var elem = $('li#resource_' + resource + ' ul.endpoints');
149
+ elem.slideUp();
150
+ },
151
+
152
+ expandOperationsForResource: function(resource) {
153
+ // Make sure the resource container is open..
154
+ Docs.expandEndpointListForResource(resource);
155
+
156
+ if (resource == '') {
157
+ $('.resource ul.endpoints li.operation div.content').slideDown();
158
+ return;
159
+ }
160
+
161
+ $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
162
+ Docs.expandOperation($(this));
163
+ });
164
+ },
165
+
166
+ collapseOperationsForResource: function(resource) {
167
+ // Make sure the resource container is open..
168
+ Docs.expandEndpointListForResource(resource);
169
+
170
+ $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
171
+ Docs.collapseOperation($(this));
172
+ });
173
+ },
174
+
175
+ escapeResourceName: function(resource) {
176
+ return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
177
+ },
178
+
179
+ expandOperation: function(elem) {
180
+ elem.slideDown();
181
+ },
182
+
183
+ collapseOperation: function(elem) {
184
+ elem.slideUp();
185
+ }
186
+ };(function() {
187
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
188
+ templates['apikey_button_view'] = template(function (Handlebars,depth0,helpers,partials,data) {
189
+ this.compilerInfo = [4,'>= 1.0.0'];
190
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
191
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
174
192
 
175
- collapseOperationsForResource: function(resource) {
176
- // Make sure the resource container is open..
177
- Docs.expandEndpointListForResource(resource);
178
193
 
179
- $('li#resource_' + Docs.escapeResourceName(resource) + ' li.operation div.content').each(function() {
180
- Docs.collapseOperation($(this));
181
- });
182
- },
194
+ buffer += "<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'>";
195
+ if (stack1 = helpers.keyName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
196
+ else { stack1 = depth0.keyName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
197
+ buffer += escapeExpression(stack1)
198
+ + "</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=\"#\">apply</a></div>\n </div>\n</div>\n\n";
199
+ return buffer;
200
+ });
201
+ })();
183
202
 
184
- escapeResourceName: function(resource) {
185
- return resource.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]\^`{|}~]/g, "\\$&");
186
- },
203
+ (function() {
204
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
205
+ templates['basic_auth_button_view'] = template(function (Handlebars,depth0,helpers,partials,data) {
206
+ this.compilerInfo = [4,'>= 1.0.0'];
207
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
208
+
187
209
 
188
- expandOperation: function(elem) {
189
- elem.slideDown();
190
- },
191
210
 
192
- collapseOperation: function(elem) {
193
- elem.slideUp();
194
- }
211
+ 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\">Username</div>\n <input placeholder=\"username\" class=\"auth_input\" id=\"input_username\" name=\"username\" type=\"text\"/>\n <div class=\"auth_label\">Password</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";
212
+ });
213
+ })();
195
214
 
196
- };
197
215
  (function() {
198
216
  var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
199
217
  templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
@@ -202,7 +220,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
202
220
  var buffer = "", stack1, functionType="function", self=this;
203
221
 
204
222
  function program1(depth0,data) {
205
-
223
+
206
224
  var buffer = "", stack1;
207
225
  buffer += "\n ";
208
226
  stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
@@ -211,21 +229,21 @@ function program1(depth0,data) {
211
229
  return buffer;
212
230
  }
213
231
  function program2(depth0,data) {
214
-
232
+
215
233
  var buffer = "", stack1;
216
- buffer += "\n <option value=\"";
234
+ buffer += "\n <option value=\"";
217
235
  stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
218
236
  if(stack1 || stack1 === 0) { buffer += stack1; }
219
237
  buffer += "\">";
220
238
  stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
221
239
  if(stack1 || stack1 === 0) { buffer += stack1; }
222
- buffer += "</option>\n ";
240
+ buffer += "</option>\n ";
223
241
  return buffer;
224
242
  }
225
243
 
226
244
  function program4(depth0,data) {
227
-
228
-
245
+
246
+
229
247
  return "\n <option value=\"application/json\">application/json</option>\n";
230
248
  }
231
249
 
@@ -242,30 +260,30 @@ function program4(depth0,data) {
242
260
  templates['main'] = template(function (Handlebars,depth0,helpers,partials,data) {
243
261
  this.compilerInfo = [4,'>= 1.0.0'];
244
262
  helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
245
- var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
263
+ var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this;
246
264
 
247
265
  function program1(depth0,data) {
248
-
266
+
249
267
  var buffer = "", stack1, stack2;
250
- buffer += "\n <div class=\"info_title\">"
268
+ buffer += "\n <div class=\"info_title\">"
251
269
  + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
252
- + "</div>\n <div class=\"info_description\">";
270
+ + "</div>\n <div class=\"info_description\">";
253
271
  stack2 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.description)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
254
272
  if(stack2 || stack2 === 0) { buffer += stack2; }
255
- buffer += "</div>\n ";
273
+ buffer += "</div>\n ";
256
274
  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});
257
275
  if(stack2 || stack2 === 0) { buffer += stack2; }
258
- buffer += "\n ";
276
+ buffer += "\n ";
259
277
  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});
260
278
  if(stack2 || stack2 === 0) { buffer += stack2; }
261
- buffer += "\n ";
279
+ buffer += "\n ";
262
280
  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});
263
281
  if(stack2 || stack2 === 0) { buffer += stack2; }
264
282
  buffer += "\n ";
265
283
  return buffer;
266
284
  }
267
285
  function program2(depth0,data) {
268
-
286
+
269
287
  var buffer = "", stack1;
270
288
  buffer += "<div class=\"info_tos\"><a href=\""
271
289
  + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.termsOfServiceUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
@@ -274,47 +292,71 @@ function program2(depth0,data) {
274
292
  }
275
293
 
276
294
  function program4(depth0,data) {
277
-
295
+
278
296
  var buffer = "", stack1;
279
297
  buffer += "<div class='info_contact'><a href=\"mailto:"
280
- + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
298
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.contact)),stack1 == null || stack1 === false ? stack1 : stack1.name)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
281
299
  + "\">Contact the developer</a></div>";
282
300
  return buffer;
283
301
  }
284
302
 
285
303
  function program6(depth0,data) {
286
-
304
+
287
305
  var buffer = "", stack1;
288
306
  buffer += "<div class='info_license'><a href='"
289
- + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.licenseUrl)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
307
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),stack1 == null || stack1 === false ? stack1 : stack1.url)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
290
308
  + "'>"
291
- + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
309
+ + escapeExpression(((stack1 = ((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.license)),stack1 == null || stack1 === false ? stack1 : stack1.name)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
292
310
  + "</a></div>";
293
311
  return buffer;
294
312
  }
295
313
 
296
314
  function program8(depth0,data) {
315
+
316
+ var buffer = "", stack1;
317
+ buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: "
318
+ + escapeExpression(((stack1 = ((stack1 = depth0.info),stack1 == null || stack1 === false ? stack1 : stack1.version)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
319
+ + "\n ";
320
+ return buffer;
321
+ }
297
322
 
323
+ function program10(depth0,data) {
324
+
298
325
  var buffer = "", stack1;
299
- buffer += "\n , <span style=\"font-variant: small-caps\">api version</span>: ";
300
- if (stack1 = helpers.apiVersion) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
301
- else { stack1 = depth0.apiVersion; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
326
+ buffer += "\n <span style=\"float:right\"><a href=\"";
327
+ if (stack1 = helpers.validatorUrl) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
328
+ else { stack1 = depth0.validatorUrl; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
302
329
  buffer += escapeExpression(stack1)
303
- + "\n ";
330
+ + "/debug?url=";
331
+ if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
332
+ else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
333
+ buffer += escapeExpression(stack1)
334
+ + "\"><img id=\"validator\" src=\"";
335
+ if (stack1 = helpers.validatorUrl) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
336
+ else { stack1 = depth0.validatorUrl; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
337
+ buffer += escapeExpression(stack1)
338
+ + "?url=";
339
+ if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
340
+ else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
341
+ buffer += escapeExpression(stack1)
342
+ + "\"></a>\n </span>\n ";
304
343
  return buffer;
305
344
  }
306
345
 
307
346
  buffer += "<div class='info' id='api_info'>\n ";
308
347
  stack1 = helpers['if'].call(depth0, depth0.info, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
309
348
  if(stack1 || stack1 === 0) { buffer += stack1; }
310
- buffer += "\n</div>\n<div class='container' id='resources_container'>\n <ul id='resources'>\n </ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";
349
+ buffer += "\n</div>\n<div class='container' id='resources_container'>\n <ul id='resources'></ul>\n\n <div class=\"footer\">\n <br>\n <br>\n <h4 style=\"color: #999\">[ <span style=\"font-variant: small-caps\">base url</span>: ";
311
350
  if (stack1 = helpers.basePath) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
312
351
  else { stack1 = depth0.basePath; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
313
352
  buffer += escapeExpression(stack1)
314
- + "\n ";
315
- stack1 = helpers['if'].call(depth0, depth0.apiVersion, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
316
- if(stack1 || stack1 === 0) { buffer += stack1; }
317
- buffer += "]</h4>\n </div>\n</div>\n";
353
+ + "\n ";
354
+ 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});
355
+ if(stack2 || stack2 === 0) { buffer += stack2; }
356
+ buffer += "]\n ";
357
+ stack2 = helpers['if'].call(depth0, depth0.validatorUrl, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
358
+ if(stack2 || stack2 === 0) { buffer += stack2; }
359
+ buffer += "\n </h4>\n </div>\n</div>\n";
318
360
  return buffer;
319
361
  });
320
362
  })();
@@ -324,47 +366,98 @@ function program8(depth0,data) {
324
366
  templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
325
367
  this.compilerInfo = [4,'>= 1.0.0'];
326
368
  helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
327
- var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
369
+ var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
328
370
 
329
371
  function program1(depth0,data) {
372
+
373
+
374
+ return "deprecated";
375
+ }
376
+
377
+ function program3(depth0,data) {
378
+
379
+
380
+ return "\n <h4>Warning: Deprecated</h4>\n ";
381
+ }
330
382
 
383
+ function program5(depth0,data) {
384
+
331
385
  var buffer = "", stack1;
332
386
  buffer += "\n <h4>Implementation Notes</h4>\n <p>";
333
- if (stack1 = helpers.notes) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
334
- else { stack1 = depth0.notes; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
387
+ if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
388
+ else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
335
389
  if(stack1 || stack1 === 0) { buffer += stack1; }
336
390
  buffer += "</p>\n ";
337
391
  return buffer;
338
392
  }
339
393
 
340
- function program3(depth0,data) {
394
+ function program7(depth0,data) {
395
+
396
+
397
+ return "\n <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
398
+ }
341
399
 
400
+ function program9(depth0,data) {
401
+
402
+ var buffer = "", stack1;
403
+ buffer += "\n <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n ";
404
+ stack1 = helpers.each.call(depth0, depth0, {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data});
405
+ if(stack1 || stack1 === 0) { buffer += stack1; }
406
+ buffer += "\n </div>\n ";
407
+ return buffer;
408
+ }
409
+ function program10(depth0,data) {
410
+
411
+ var buffer = "", stack1, stack2;
412
+ buffer += "\n <div title='";
413
+ stack2 = ((stack1 = depth0.description),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
414
+ if(stack2 || stack2 === 0) { buffer += stack2; }
415
+ buffer += "'>"
416
+ + escapeExpression(((stack1 = depth0.scope),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
417
+ + "</div>\n ";
418
+ return buffer;
419
+ }
342
420
 
343
- return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";
421
+ function program12(depth0,data) {
422
+
423
+
424
+ return "</div>";
344
425
  }
345
426
 
346
- function program5(depth0,data) {
427
+ function program14(depth0,data) {
428
+
429
+
430
+ return "\n <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n ";
431
+ }
347
432
 
433
+ function program16(depth0,data) {
434
+
435
+
436
+ return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";
437
+ }
348
438
 
439
+ function program18(depth0,data) {
440
+
441
+
349
442
  return "\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n ";
350
443
  }
351
444
 
352
- function program7(depth0,data) {
353
-
354
-
355
- return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Error Status Codes</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";
445
+ function program20(depth0,data) {
446
+
447
+
448
+ return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";
356
449
  }
357
450
 
358
- function program9(depth0,data) {
359
-
360
-
451
+ function program22(depth0,data) {
452
+
453
+
361
454
  return "\n ";
362
455
  }
363
456
 
364
- function program11(depth0,data) {
365
-
366
-
367
- return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='<%= asset_path('throbber.gif') %>' style='display:none' />\n </div>\n ";
457
+ function program24(depth0,data) {
458
+
459
+
460
+ return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <span class='response_throbber' style='display:none'></span>\n </div>\n ";
368
461
  }
369
462
 
370
463
  buffer += "\n <ul class='operations' >\n <li class='";
@@ -372,111 +465,98 @@ function program11(depth0,data) {
372
465
  else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
373
466
  buffer += escapeExpression(stack1)
374
467
  + " operation' id='";
375
- if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
376
- else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
468
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
469
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
377
470
  buffer += escapeExpression(stack1)
378
471
  + "_";
379
472
  if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
380
473
  else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
381
- buffer += escapeExpression(stack1)
382
- + "_";
383
- if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
384
- else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
385
- buffer += escapeExpression(stack1)
386
- + "_";
387
- if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
388
- else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
389
474
  buffer += escapeExpression(stack1)
390
475
  + "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
391
- if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
392
- else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
476
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
477
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
393
478
  buffer += escapeExpression(stack1)
394
479
  + "/";
395
480
  if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
396
481
  else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
397
- buffer += escapeExpression(stack1)
398
- + "_";
399
- if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
400
- else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
401
- buffer += escapeExpression(stack1)
402
- + "_";
403
- if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
404
- else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
405
482
  buffer += escapeExpression(stack1)
406
483
  + "' class=\"toggleOperation\">";
407
484
  if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
408
485
  else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
409
486
  buffer += escapeExpression(stack1)
410
487
  + "</a>\n </span>\n <span class='path'>\n <a href='#!/";
411
- if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
412
- else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
488
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
489
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
413
490
  buffer += escapeExpression(stack1)
414
491
  + "/";
415
492
  if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
416
493
  else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
417
494
  buffer += escapeExpression(stack1)
418
- + "_";
419
- if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
420
- else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
421
- buffer += escapeExpression(stack1)
422
- + "_";
423
- if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
424
- else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
425
- buffer += escapeExpression(stack1)
426
- + "' class=\"toggleOperation\">";
495
+ + "' class=\"toggleOperation ";
496
+ stack1 = helpers['if'].call(depth0, depth0.deprecated, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
497
+ if(stack1 || stack1 === 0) { buffer += stack1; }
498
+ buffer += "\">";
427
499
  if (stack1 = helpers.path) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
428
500
  else { stack1 = depth0.path; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
429
501
  buffer += escapeExpression(stack1)
430
502
  + "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
431
- if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
432
- else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
503
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
504
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
433
505
  buffer += escapeExpression(stack1)
434
506
  + "/";
435
507
  if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
436
508
  else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
437
- buffer += escapeExpression(stack1)
438
- + "_";
439
- if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
440
- else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
441
- buffer += escapeExpression(stack1)
442
- + "_";
443
- if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
444
- else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
445
509
  buffer += escapeExpression(stack1)
446
510
  + "' class=\"toggleOperation\">";
447
511
  if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
448
512
  else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
449
513
  if(stack1 || stack1 === 0) { buffer += stack1; }
450
514
  buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
451
- if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
452
- else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
515
+ if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
516
+ else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
453
517
  buffer += escapeExpression(stack1)
454
518
  + "_";
455
519
  if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
456
520
  else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
457
- buffer += escapeExpression(stack1)
458
- + "_";
459
- if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
460
- else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
461
- buffer += escapeExpression(stack1)
462
- + "_";
463
- if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
464
- else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
465
521
  buffer += escapeExpression(stack1)
466
522
  + "_content' style='display:none'>\n ";
467
- stack1 = helpers['if'].call(depth0, depth0.notes, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
523
+ stack1 = helpers['if'].call(depth0, depth0.deprecated, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
524
+ if(stack1 || stack1 === 0) { buffer += stack1; }
525
+ buffer += "\n ";
526
+ stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
527
+ if(stack1 || stack1 === 0) { buffer += stack1; }
528
+ buffer += "\n ";
529
+ options = {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data};
530
+ if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
531
+ else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
532
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
533
+ if(stack1 || stack1 === 0) { buffer += stack1; }
534
+ buffer += "\n ";
535
+ stack1 = helpers.each.call(depth0, depth0.oauth, {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data});
536
+ if(stack1 || stack1 === 0) { buffer += stack1; }
537
+ buffer += "\n ";
538
+ options = {hash:{},inverse:self.noop,fn:self.program(12, program12, data),data:data};
539
+ if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
540
+ else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
541
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
542
+ if(stack1 || stack1 === 0) { buffer += stack1; }
543
+ buffer += "\n ";
544
+ options = {hash:{},inverse:self.noop,fn:self.program(14, program14, data),data:data};
545
+ if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
546
+ else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
547
+ if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
468
548
  if(stack1 || stack1 === 0) { buffer += stack1; }
469
549
  buffer += "\n ";
470
- stack1 = helpers['if'].call(depth0, depth0.type, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
550
+ stack1 = helpers['if'].call(depth0, depth0.type, {hash:{},inverse:self.noop,fn:self.program(16, program16, data),data:data});
471
551
  if(stack1 || stack1 === 0) { buffer += stack1; }
472
552
  buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";
473
- stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
553
+ stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(18, program18, data),data:data});
474
554
  if(stack1 || stack1 === 0) { buffer += stack1; }
475
555
  buffer += "\n ";
476
- stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
556
+ stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(20, program20, data),data:data});
477
557
  if(stack1 || stack1 === 0) { buffer += stack1; }
478
558
  buffer += "\n ";
479
- stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
559
+ stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(24, program24, data),fn:self.program(22, program22, data),data:data});
480
560
  if(stack1 || stack1 === 0) { buffer += stack1; }
481
561
  buffer += "\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";
482
562
  return buffer;
@@ -491,92 +571,101 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
491
571
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
492
572
 
493
573
  function program1(depth0,data) {
494
-
574
+
495
575
  var buffer = "", stack1;
496
- buffer += "\n ";
576
+ buffer += "\n ";
497
577
  stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
498
578
  if(stack1 || stack1 === 0) { buffer += stack1; }
499
- buffer += "\n ";
579
+ buffer += "\n ";
500
580
  return buffer;
501
581
  }
502
582
  function program2(depth0,data) {
503
-
583
+
504
584
  var buffer = "", stack1;
505
- buffer += "\n <input type=\"file\" name='";
585
+ buffer += "\n <input type=\"file\" name='";
506
586
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
507
587
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
508
588
  buffer += escapeExpression(stack1)
509
- + "'/>\n <div class=\"parameter-content-type\" />\n ";
589
+ + "'/>\n <div class=\"parameter-content-type\" />\n ";
510
590
  return buffer;
511
591
  }
512
592
 
513
593
  function program4(depth0,data) {
514
-
594
+
515
595
  var buffer = "", stack1;
516
- buffer += "\n ";
517
- stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
596
+ buffer += "\n ";
597
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
518
598
  if(stack1 || stack1 === 0) { buffer += stack1; }
519
- buffer += "\n ";
599
+ buffer += "\n ";
520
600
  return buffer;
521
601
  }
522
602
  function program5(depth0,data) {
523
-
603
+
524
604
  var buffer = "", stack1;
525
- buffer += "\n <textarea class='body-textarea' name='";
605
+ buffer += "\n <textarea class='body-textarea' name='";
526
606
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
527
607
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
528
608
  buffer += escapeExpression(stack1)
529
609
  + "'>";
530
- if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
531
- else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
610
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
611
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
532
612
  buffer += escapeExpression(stack1)
533
- + "</textarea>\n ";
613
+ + "</textarea>\n ";
534
614
  return buffer;
535
615
  }
536
616
 
537
617
  function program7(depth0,data) {
538
-
618
+
539
619
  var buffer = "", stack1;
540
- buffer += "\n <textarea class='body-textarea' name='";
620
+ buffer += "\n <textarea class='body-textarea' name='";
541
621
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
542
622
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
543
623
  buffer += escapeExpression(stack1)
544
- + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
624
+ + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
545
625
  return buffer;
546
626
  }
547
627
 
548
628
  function program9(depth0,data) {
549
-
629
+
550
630
  var buffer = "", stack1;
551
- buffer += "\n ";
552
- stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data});
631
+ buffer += "\n ";
632
+ stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(10, program10, data),fn:self.program(2, program2, data),data:data});
553
633
  if(stack1 || stack1 === 0) { buffer += stack1; }
554
- buffer += "\n ";
634
+ buffer += "\n ";
555
635
  return buffer;
556
636
  }
557
637
  function program10(depth0,data) {
558
-
638
+
559
639
  var buffer = "", stack1;
560
- buffer += "\n <input class='parameter' minlength='0' name='";
640
+ buffer += "\n ";
641
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(13, program13, data),fn:self.program(11, program11, data),data:data});
642
+ if(stack1 || stack1 === 0) { buffer += stack1; }
643
+ buffer += "\n ";
644
+ return buffer;
645
+ }
646
+ function program11(depth0,data) {
647
+
648
+ var buffer = "", stack1;
649
+ buffer += "\n <input class='parameter' minlength='0' name='";
561
650
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
562
651
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
563
652
  buffer += escapeExpression(stack1)
564
653
  + "' placeholder='' type='text' value='";
565
- if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
566
- else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
654
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
655
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
567
656
  buffer += escapeExpression(stack1)
568
- + "'/>\n ";
657
+ + "'/>\n ";
569
658
  return buffer;
570
659
  }
571
660
 
572
- function program12(depth0,data) {
573
-
661
+ function program13(depth0,data) {
662
+
574
663
  var buffer = "", stack1;
575
- buffer += "\n <input class='parameter' minlength='0' name='";
664
+ buffer += "\n <input class='parameter' minlength='0' name='";
576
665
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
577
666
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
578
667
  buffer += escapeExpression(stack1)
579
- + "' placeholder='' type='text' value=''/>\n ";
668
+ + "' placeholder='' type='text' value=''/>\n ";
580
669
  return buffer;
581
670
  }
582
671
 
@@ -584,7 +673,7 @@ function program12(depth0,data) {
584
673
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
585
674
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
586
675
  buffer += escapeExpression(stack1)
587
- + "</td>\n<td>\n\n ";
676
+ + "</td>\n<td>\n\n ";
588
677
  stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data});
589
678
  if(stack1 || stack1 === 0) { buffer += stack1; }
590
679
  buffer += "\n\n</td>\n<td>";
@@ -595,7 +684,7 @@ function program12(depth0,data) {
595
684
  if (stack1 = helpers.paramType) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
596
685
  else { stack1 = depth0.paramType; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
597
686
  if(stack1 || stack1 === 0) { buffer += stack1; }
598
- buffer += "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
687
+ buffer += "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
599
688
  return buffer;
600
689
  });
601
690
  })();
@@ -605,58 +694,59 @@ function program12(depth0,data) {
605
694
  templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
606
695
  this.compilerInfo = [4,'>= 1.0.0'];
607
696
  helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
608
- var buffer = "", stack1, stack2, self=this, functionType="function", escapeExpression=this.escapeExpression;
697
+ var buffer = "", stack1, stack2, options, self=this, helperMissing=helpers.helperMissing, functionType="function", escapeExpression=this.escapeExpression;
609
698
 
610
699
  function program1(depth0,data) {
611
-
612
-
700
+
701
+
613
702
  return " multiple='multiple'";
614
703
  }
615
704
 
616
705
  function program3(depth0,data) {
617
-
618
-
706
+
707
+
619
708
  return "\n ";
620
709
  }
621
710
 
622
711
  function program5(depth0,data) {
623
-
712
+
624
713
  var buffer = "", stack1;
625
714
  buffer += "\n ";
626
- stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(8, program8, data),fn:self.program(6, program6, data),data:data});
715
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(8, program8, data),fn:self.program(6, program6, data),data:data});
627
716
  if(stack1 || stack1 === 0) { buffer += stack1; }
628
717
  buffer += "\n ";
629
718
  return buffer;
630
719
  }
631
720
  function program6(depth0,data) {
632
-
633
-
721
+
722
+
634
723
  return "\n ";
635
724
  }
636
725
 
637
726
  function program8(depth0,data) {
638
-
639
- var buffer = "", stack1;
727
+
728
+ var buffer = "", stack1, stack2, options;
640
729
  buffer += "\n ";
641
- stack1 = helpers['if'].call(depth0, depth0.allowMultiple, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
642
- if(stack1 || stack1 === 0) { buffer += stack1; }
730
+ options = {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data};
731
+ stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options));
732
+ if(stack2 || stack2 === 0) { buffer += stack2; }
643
733
  buffer += "\n ";
644
734
  return buffer;
645
735
  }
646
736
  function program9(depth0,data) {
647
-
648
-
649
- return "\n ";
737
+
738
+
739
+ return "\n ";
650
740
  }
651
741
 
652
742
  function program11(depth0,data) {
653
-
654
-
655
- return "\n <option selected=\"\" value=''></option>\n ";
743
+
744
+
745
+ return "\n <option selected=\"\" value=''></option>\n ";
656
746
  }
657
747
 
658
748
  function program13(depth0,data) {
659
-
749
+
660
750
  var buffer = "", stack1;
661
751
  buffer += "\n ";
662
752
  stack1 = helpers['if'].call(depth0, depth0.isDefault, {hash:{},inverse:self.program(16, program16, data),fn:self.program(14, program14, data),data:data});
@@ -665,7 +755,7 @@ function program13(depth0,data) {
665
755
  return buffer;
666
756
  }
667
757
  function program14(depth0,data) {
668
-
758
+
669
759
  var buffer = "", stack1;
670
760
  buffer += "\n <option selected=\"\" value='";
671
761
  if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
@@ -680,7 +770,7 @@ function program14(depth0,data) {
680
770
  }
681
771
 
682
772
  function program16(depth0,data) {
683
-
773
+
684
774
  var buffer = "", stack1;
685
775
  buffer += "\n <option value='";
686
776
  if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
@@ -699,15 +789,16 @@ function program16(depth0,data) {
699
789
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
700
790
  buffer += escapeExpression(stack1)
701
791
  + "</td>\n<td>\n <select ";
702
- stack1 = helpers['if'].call(depth0, depth0.allowMultiple, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
703
- if(stack1 || stack1 === 0) { buffer += stack1; }
792
+ options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
793
+ stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options));
794
+ if(stack2 || stack2 === 0) { buffer += stack2; }
704
795
  buffer += " class='parameter' name='";
705
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
706
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
707
- buffer += escapeExpression(stack1)
796
+ if (stack2 = helpers.name) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
797
+ else { stack2 = depth0.name; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
798
+ buffer += escapeExpression(stack2)
708
799
  + "'>\n ";
709
- stack1 = helpers['if'].call(depth0, depth0.required, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
710
- if(stack1 || stack1 === 0) { buffer += stack1; }
800
+ stack2 = helpers['if'].call(depth0, depth0.required, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
801
+ if(stack2 || stack2 === 0) { buffer += stack2; }
711
802
  buffer += "\n ";
712
803
  stack2 = helpers.each.call(depth0, ((stack1 = depth0.allowableValues),stack1 == null || stack1 === false ? stack1 : stack1.descriptiveValues), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
713
804
  if(stack2 || stack2 === 0) { buffer += stack2; }
@@ -732,43 +823,43 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
732
823
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
733
824
 
734
825
  function program1(depth0,data) {
735
-
826
+
736
827
  var buffer = "", stack1;
737
828
  buffer += "\n <textarea class='body-textarea' readonly='readonly' name='";
738
829
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
739
830
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
740
831
  buffer += escapeExpression(stack1)
741
832
  + "'>";
742
- if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
743
- else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
833
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
834
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
744
835
  buffer += escapeExpression(stack1)
745
836
  + "</textarea>\n ";
746
837
  return buffer;
747
838
  }
748
839
 
749
840
  function program3(depth0,data) {
750
-
841
+
751
842
  var buffer = "", stack1;
752
843
  buffer += "\n ";
753
- stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
844
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
754
845
  if(stack1 || stack1 === 0) { buffer += stack1; }
755
846
  buffer += "\n ";
756
847
  return buffer;
757
848
  }
758
849
  function program4(depth0,data) {
759
-
850
+
760
851
  var buffer = "", stack1;
761
852
  buffer += "\n ";
762
- if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
763
- else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
853
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
854
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
764
855
  buffer += escapeExpression(stack1)
765
856
  + "\n ";
766
857
  return buffer;
767
858
  }
768
859
 
769
860
  function program6(depth0,data) {
770
-
771
-
861
+
862
+
772
863
  return "\n (empty)\n ";
773
864
  }
774
865
 
@@ -800,43 +891,43 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
800
891
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
801
892
 
802
893
  function program1(depth0,data) {
803
-
894
+
804
895
  var buffer = "", stack1;
805
896
  buffer += "\n <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='";
806
897
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
807
898
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
808
899
  buffer += escapeExpression(stack1)
809
900
  + "'>";
810
- if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
811
- else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
901
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
902
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
812
903
  buffer += escapeExpression(stack1)
813
904
  + "</textarea>\n ";
814
905
  return buffer;
815
906
  }
816
907
 
817
908
  function program3(depth0,data) {
818
-
909
+
819
910
  var buffer = "", stack1;
820
911
  buffer += "\n ";
821
- stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
912
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
822
913
  if(stack1 || stack1 === 0) { buffer += stack1; }
823
914
  buffer += "\n ";
824
915
  return buffer;
825
916
  }
826
917
  function program4(depth0,data) {
827
-
918
+
828
919
  var buffer = "", stack1;
829
920
  buffer += "\n ";
830
- if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
831
- else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
921
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
922
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
832
923
  buffer += escapeExpression(stack1)
833
924
  + "\n ";
834
925
  return buffer;
835
926
  }
836
927
 
837
928
  function program6(depth0,data) {
838
-
839
-
929
+
930
+
840
931
  return "\n (empty)\n ";
841
932
  }
842
933
 
@@ -868,112 +959,112 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
868
959
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
869
960
 
870
961
  function program1(depth0,data) {
871
-
962
+
872
963
  var buffer = "", stack1;
873
- buffer += "\n ";
964
+ buffer += "\n ";
874
965
  stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
875
966
  if(stack1 || stack1 === 0) { buffer += stack1; }
876
- buffer += "\n ";
967
+ buffer += "\n ";
877
968
  return buffer;
878
969
  }
879
970
  function program2(depth0,data) {
880
-
971
+
881
972
  var buffer = "", stack1;
882
- buffer += "\n <input type=\"file\" name='";
973
+ buffer += "\n <input type=\"file\" name='";
883
974
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
884
975
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
885
976
  buffer += escapeExpression(stack1)
886
- + "'/>\n ";
977
+ + "'/>\n ";
887
978
  return buffer;
888
979
  }
889
980
 
890
981
  function program4(depth0,data) {
891
-
982
+
892
983
  var buffer = "", stack1;
893
- buffer += "\n ";
894
- stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
984
+ buffer += "\n ";
985
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
895
986
  if(stack1 || stack1 === 0) { buffer += stack1; }
896
- buffer += "\n ";
987
+ buffer += "\n ";
897
988
  return buffer;
898
989
  }
899
990
  function program5(depth0,data) {
900
-
991
+
901
992
  var buffer = "", stack1;
902
- buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
993
+ buffer += "\n <textarea class='body-textarea required' placeholder='(required)' name='";
903
994
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
904
995
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
905
996
  buffer += escapeExpression(stack1)
906
997
  + "'>";
907
- if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
908
- else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
998
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
999
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
909
1000
  buffer += escapeExpression(stack1)
910
- + "</textarea>\n ";
1001
+ + "</textarea>\n ";
911
1002
  return buffer;
912
1003
  }
913
1004
 
914
1005
  function program7(depth0,data) {
915
-
1006
+
916
1007
  var buffer = "", stack1;
917
- buffer += "\n <textarea class='body-textarea' placeholder='(required)' name='";
1008
+ buffer += "\n <textarea class='body-textarea required' placeholder='(required)' name='";
918
1009
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
919
1010
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
920
1011
  buffer += escapeExpression(stack1)
921
- + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
1012
+ + "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n ";
922
1013
  return buffer;
923
1014
  }
924
1015
 
925
1016
  function program9(depth0,data) {
926
-
1017
+
927
1018
  var buffer = "", stack1;
928
- buffer += "\n ";
1019
+ buffer += "\n ";
929
1020
  stack1 = helpers['if'].call(depth0, depth0.isFile, {hash:{},inverse:self.program(12, program12, data),fn:self.program(10, program10, data),data:data});
930
1021
  if(stack1 || stack1 === 0) { buffer += stack1; }
931
- buffer += "\n ";
1022
+ buffer += "\n ";
932
1023
  return buffer;
933
1024
  }
934
1025
  function program10(depth0,data) {
935
-
1026
+
936
1027
  var buffer = "", stack1;
937
- buffer += "\n <input class='parameter' class='required' type='file' name='";
1028
+ buffer += "\n <input class='parameter' class='required' type='file' name='";
938
1029
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
939
1030
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
940
1031
  buffer += escapeExpression(stack1)
941
- + "'/>\n ";
1032
+ + "'/>\n ";
942
1033
  return buffer;
943
1034
  }
944
1035
 
945
1036
  function program12(depth0,data) {
946
-
1037
+
947
1038
  var buffer = "", stack1;
948
- buffer += "\n ";
949
- stack1 = helpers['if'].call(depth0, depth0.defaultValue, {hash:{},inverse:self.program(15, program15, data),fn:self.program(13, program13, data),data:data});
1039
+ buffer += "\n ";
1040
+ stack1 = helpers['if'].call(depth0, depth0['default'], {hash:{},inverse:self.program(15, program15, data),fn:self.program(13, program13, data),data:data});
950
1041
  if(stack1 || stack1 === 0) { buffer += stack1; }
951
- buffer += "\n ";
1042
+ buffer += "\n ";
952
1043
  return buffer;
953
1044
  }
954
1045
  function program13(depth0,data) {
955
-
1046
+
956
1047
  var buffer = "", stack1;
957
- buffer += "\n <input class='parameter required' minlength='1' name='";
1048
+ buffer += "\n <input class='parameter required' minlength='1' name='";
958
1049
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
959
1050
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
960
1051
  buffer += escapeExpression(stack1)
961
1052
  + "' placeholder='(required)' type='text' value='";
962
- if (stack1 = helpers.defaultValue) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
963
- else { stack1 = depth0.defaultValue; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1053
+ if (stack1 = helpers['default']) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1054
+ else { stack1 = depth0['default']; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
964
1055
  buffer += escapeExpression(stack1)
965
- + "'/>\n ";
1056
+ + "'/>\n ";
966
1057
  return buffer;
967
1058
  }
968
1059
 
969
1060
  function program15(depth0,data) {
970
-
1061
+
971
1062
  var buffer = "", stack1;
972
- buffer += "\n <input class='parameter required' minlength='1' name='";
1063
+ buffer += "\n <input class='parameter required' minlength='1' name='";
973
1064
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
974
1065
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
975
1066
  buffer += escapeExpression(stack1)
976
- + "' placeholder='(required)' type='text' value=''/>\n ";
1067
+ + "' placeholder='(required)' type='text' value=''/>\n ";
977
1068
  return buffer;
978
1069
  }
979
1070
 
@@ -981,10 +1072,10 @@ function program15(depth0,data) {
981
1072
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
982
1073
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
983
1074
  buffer += escapeExpression(stack1)
984
- + "</td>\n<td>\n ";
1075
+ + "</td>\n<td>\n ";
985
1076
  stack1 = helpers['if'].call(depth0, depth0.isBody, {hash:{},inverse:self.program(9, program9, data),fn:self.program(1, program1, data),data:data});
986
1077
  if(stack1 || stack1 === 0) { buffer += stack1; }
987
- buffer += "\n</td>\n<td>\n <strong>";
1078
+ buffer += "\n</td>\n<td>\n <strong>";
988
1079
  if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
989
1080
  else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
990
1081
  if(stack1 || stack1 === 0) { buffer += stack1; }
@@ -1005,7 +1096,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1005
1096
  var buffer = "", stack1, functionType="function", self=this;
1006
1097
 
1007
1098
  function program1(depth0,data) {
1008
-
1099
+
1009
1100
  var buffer = "", stack1;
1010
1101
  buffer += "\n ";
1011
1102
  stack1 = helpers.each.call(depth0, depth0.consumes, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
@@ -1014,7 +1105,7 @@ function program1(depth0,data) {
1014
1105
  return buffer;
1015
1106
  }
1016
1107
  function program2(depth0,data) {
1017
-
1108
+
1018
1109
  var buffer = "", stack1;
1019
1110
  buffer += "\n <option value=\"";
1020
1111
  stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
@@ -1027,8 +1118,8 @@ function program2(depth0,data) {
1027
1118
  }
1028
1119
 
1029
1120
  function program4(depth0,data) {
1030
-
1031
-
1121
+
1122
+
1032
1123
  return "\n <option value=\"application/json\">application/json</option>\n";
1033
1124
  }
1034
1125
 
@@ -1048,59 +1139,72 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1048
1139
  var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
1049
1140
 
1050
1141
  function program1(depth0,data) {
1051
-
1052
-
1142
+
1143
+
1053
1144
  return " : ";
1054
1145
  }
1055
1146
 
1147
+ function program3(depth0,data) {
1148
+
1149
+ var buffer = "", stack1;
1150
+ buffer += "<li>\n <a href='";
1151
+ if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1152
+ else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1153
+ buffer += escapeExpression(stack1)
1154
+ + "'>Raw</a>\n </li>";
1155
+ return buffer;
1156
+ }
1157
+
1056
1158
  buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
1057
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1058
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1159
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1160
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1059
1161
  buffer += escapeExpression(stack1)
1060
- + "' onclick=\"Docs.toggleEndpointListForResource('";
1061
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1062
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1162
+ + "' class=\"toggleEndpointList\" data-id=\"";
1163
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1164
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1063
1165
  buffer += escapeExpression(stack1)
1064
- + "');\">";
1166
+ + "\">";
1065
1167
  if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1066
1168
  else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1067
1169
  buffer += escapeExpression(stack1)
1068
1170
  + "</a> ";
1069
1171
  options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
1070
- if (stack1 = helpers.description) { stack1 = stack1.call(depth0, options); }
1071
- else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1072
- if (!helpers.description) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
1172
+ if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, options); }
1173
+ else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1174
+ if (!helpers.summary) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
1073
1175
  if(stack1 || stack1 === 0) { buffer += stack1; }
1074
- if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1075
- else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1176
+ if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1177
+ else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1076
1178
  if(stack1 || stack1 === 0) { buffer += stack1; }
1077
1179
  buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
1078
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1079
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1180
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1181
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1080
1182
  buffer += escapeExpression(stack1)
1081
1183
  + "' id='endpointListTogger_";
1082
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1083
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1184
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1185
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1084
1186
  buffer += escapeExpression(stack1)
1085
- + "'\n onclick=\"Docs.toggleEndpointListForResource('";
1086
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1087
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1187
+ + "' class=\"toggleEndpointList\" data-id=\"";
1188
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1189
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1088
1190
  buffer += escapeExpression(stack1)
1089
- + "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
1090
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1091
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1191
+ + "\">Show/Hide</a>\n </li>\n <li>\n <a href='#' class=\"collapseResource\" data-id=\"";
1192
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1193
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1092
1194
  buffer += escapeExpression(stack1)
1093
- + "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
1094
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1095
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1195
+ + "\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' class=\"expandResource\" data-id=\"";
1196
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1197
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1096
1198
  buffer += escapeExpression(stack1)
1097
- + "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
1098
- if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1199
+ + "\">\n Expand Operations\n </a>\n </li>\n ";
1200
+ options = {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data};
1201
+ if (stack1 = helpers.url) { stack1 = stack1.call(depth0, options); }
1099
1202
  else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1100
- buffer += escapeExpression(stack1)
1101
- + "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
1102
- if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1103
- else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1203
+ if (!helpers.url) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
1204
+ if(stack1 || stack1 === 0) { buffer += stack1; }
1205
+ buffer += "\n </ul>\n</div>\n<ul class='endpoints' id='";
1206
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1207
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1104
1208
  buffer += escapeExpression(stack1)
1105
1209
  + "_endpoint_list' style='display:none'>\n\n</ul>\n";
1106
1210
  return buffer;
@@ -1115,7 +1219,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1115
1219
  var buffer = "", stack1, functionType="function", self=this;
1116
1220
 
1117
1221
  function program1(depth0,data) {
1118
-
1222
+
1119
1223
  var buffer = "", stack1;
1120
1224
  buffer += "\n ";
1121
1225
  stack1 = helpers.each.call(depth0, depth0.produces, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
@@ -1124,7 +1228,7 @@ function program1(depth0,data) {
1124
1228
  return buffer;
1125
1229
  }
1126
1230
  function program2(depth0,data) {
1127
-
1231
+
1128
1232
  var buffer = "", stack1;
1129
1233
  buffer += "\n <option value=\"";
1130
1234
  stack1 = (typeof depth0 === functionType ? depth0.apply(depth0) : depth0);
@@ -1137,8 +1241,8 @@ function program2(depth0,data) {
1137
1241
  }
1138
1242
 
1139
1243
  function program4(depth0,data) {
1140
-
1141
-
1244
+
1245
+
1142
1246
  return "\n <option value=\"application/json\">application/json</option>\n";
1143
1247
  }
1144
1248
 
@@ -1158,15 +1262,15 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1158
1262
  var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
1159
1263
 
1160
1264
 
1161
- buffer += "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
1265
+ buffer += "<div>\n<ul class=\"signature-nav\">\n <li><a class=\"description-link\" href=\"#\">Model</a></li>\n <li><a class=\"snippet-link\" href=\"#\">Model Schema</a></li>\n</ul>\n<div>\n\n<div class=\"signature-container\">\n <div class=\"description\">\n ";
1162
1266
  if (stack1 = helpers.signature) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1163
1267
  else { stack1 = depth0.signature; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1164
1268
  if(stack1 || stack1 === 0) { buffer += stack1; }
1165
- buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
1269
+ buffer += "\n </div>\n\n <div class=\"snippet\">\n <pre><code>";
1166
1270
  if (stack1 = helpers.sampleJSON) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1167
1271
  else { stack1 = depth0.sampleJSON; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1168
1272
  buffer += escapeExpression(stack1)
1169
- + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
1273
+ + "</code></pre>\n <small class=\"notice\"></small>\n </div>\n</div>\n\n";
1170
1274
  return buffer;
1171
1275
  });
1172
1276
  })();
@@ -1187,7 +1291,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1187
1291
  if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
1188
1292
  else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
1189
1293
  if(stack1 || stack1 === 0) { buffer += stack1; }
1190
- buffer += "</td>\n";
1294
+ buffer += "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
1191
1295
  return buffer;
1192
1296
  });
1193
1297
  })();
@@ -1196,7 +1300,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1196
1300
 
1197
1301
  // Generated by CoffeeScript 1.6.3
1198
1302
  (function() {
1199
- var ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,
1303
+ var ApiKeyButton, BasicAuthButton, ContentTypeView, HeaderView, MainView, OperationView, ParameterContentTypeView, ParameterView, ResourceView, ResponseContentTypeView, SignatureView, StatusCodeView, SwaggerUi, _ref, _ref1, _ref10, _ref11, _ref12, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9,
1200
1304
  __hasProp = {}.hasOwnProperty,
1201
1305
  __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; };
1202
1306
 
@@ -1238,7 +1342,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1238
1342
  return _this.showMessage(d);
1239
1343
  };
1240
1344
  this.options.failure = function(d) {
1241
- return _this.onLoadFailure(d);
1345
+ if (_this.api && _this.api.isValid === false) {
1346
+ log("not a valid 2.0 spec, loading legacy client");
1347
+ _this.api = new SwaggerApi(_this.options);
1348
+ return _this.api.build();
1349
+ } else {
1350
+ return _this.onLoadFailure(d);
1351
+ }
1242
1352
  };
1243
1353
  this.headerView = new HeaderView({
1244
1354
  el: $('#header')
@@ -1248,6 +1358,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1248
1358
  });
1249
1359
  };
1250
1360
 
1361
+ SwaggerUi.prototype.setOption = function(option, value) {
1362
+ return this.options[option] = value;
1363
+ };
1364
+
1365
+ SwaggerUi.prototype.getOption = function(option) {
1366
+ return this.options[option];
1367
+ };
1368
+
1251
1369
  SwaggerUi.prototype.updateSwaggerUi = function(data) {
1252
1370
  this.options.url = data.url;
1253
1371
  return this.load();
@@ -1264,9 +1382,20 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1264
1382
  }
1265
1383
  this.options.url = url;
1266
1384
  this.headerView.update(url);
1267
- this.api = new SwaggerApi(this.options);
1268
- this.api.build();
1269
- return this.api;
1385
+ this.api = new SwaggerClient(this.options);
1386
+ return this.api.build();
1387
+ };
1388
+
1389
+ SwaggerUi.prototype.collapseAll = function() {
1390
+ return Docs.collapseEndpointListForResource('');
1391
+ };
1392
+
1393
+ SwaggerUi.prototype.listAll = function() {
1394
+ return Docs.collapseOperationsForResource('');
1395
+ };
1396
+
1397
+ SwaggerUi.prototype.expandAll = function() {
1398
+ return Docs.expandOperationsForResource('');
1270
1399
  };
1271
1400
 
1272
1401
  SwaggerUi.prototype.render = function() {
@@ -1274,15 +1403,16 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1274
1403
  this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
1275
1404
  this.mainView = new MainView({
1276
1405
  model: this.api,
1277
- el: $('#' + this.dom_id)
1406
+ el: $('#' + this.dom_id),
1407
+ swaggerOptions: this.options
1278
1408
  }).render();
1279
1409
  this.showMessage();
1280
1410
  switch (this.options.docExpansion) {
1281
1411
  case "full":
1282
- Docs.expandOperationsForResource('');
1412
+ this.expandAll();
1283
1413
  break;
1284
1414
  case "list":
1285
- Docs.collapseOperationsForResource('');
1415
+ this.listAll();
1286
1416
  }
1287
1417
  if (this.options.onComplete) {
1288
1418
  this.options.onComplete(this.api, this);
@@ -1407,6 +1537,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1407
1537
  })(Backbone.View);
1408
1538
 
1409
1539
  MainView = (function(_super) {
1540
+ var sorters;
1541
+
1410
1542
  __extends(MainView, _super);
1411
1543
 
1412
1544
  function MainView() {
@@ -1414,26 +1546,102 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1414
1546
  return _ref2;
1415
1547
  }
1416
1548
 
1417
- MainView.prototype.initialize = function() {};
1549
+ sorters = {
1550
+ 'alpha': function(a, b) {
1551
+ return a.path.localeCompare(b.path);
1552
+ },
1553
+ 'method': function(a, b) {
1554
+ return a.method.localeCompare(b.method);
1555
+ }
1556
+ };
1557
+
1558
+ MainView.prototype.initialize = function(opts) {
1559
+ var auth, key, name, url, value, _ref3;
1560
+ if (opts == null) {
1561
+ opts = {};
1562
+ }
1563
+ this.model.auths = [];
1564
+ _ref3 = this.model.securityDefinitions;
1565
+ for (key in _ref3) {
1566
+ value = _ref3[key];
1567
+ auth = {
1568
+ name: key,
1569
+ type: value.type,
1570
+ value: value
1571
+ };
1572
+ this.model.auths.push(auth);
1573
+ }
1574
+ if (this.model.info && this.model.info.license && typeof this.model.info.license === 'string') {
1575
+ name = this.model.info.license;
1576
+ url = this.model.info.licenseUrl;
1577
+ this.model.info.license = {};
1578
+ this.model.info.license.name = name;
1579
+ this.model.info.license.url = url;
1580
+ }
1581
+ if (!this.model.info) {
1582
+ this.model.info = {};
1583
+ }
1584
+ if (!this.model.info.version) {
1585
+ this.model.info.version = this.model.apiVersion;
1586
+ }
1587
+ if (this.model.swaggerVersion === "2.0") {
1588
+ if ("validatorUrl" in opts.swaggerOptions) {
1589
+ return this.model.validatorUrl = opts.swaggerOptions.validatorUrl;
1590
+ } else if (this.model.url.indexOf("localhost") > 0) {
1591
+ return this.model.validatorUrl = null;
1592
+ } else {
1593
+ return this.model.validatorUrl = "http://online.swagger.io/validator";
1594
+ }
1595
+ }
1596
+ };
1418
1597
 
1419
1598
  MainView.prototype.render = function() {
1420
- var resource, _i, _len, _ref3;
1599
+ var auth, button, counter, id, name, resource, resources, _i, _len, _ref3;
1600
+ if (this.model.securityDefinitions) {
1601
+ for (name in this.model.securityDefinitions) {
1602
+ auth = this.model.securityDefinitions[name];
1603
+ if (auth.type === "apiKey" && $("#apikey_button").length === 0) {
1604
+ button = new ApiKeyButton({
1605
+ model: auth
1606
+ }).render().el;
1607
+ $('.auth_main_container').append(button);
1608
+ }
1609
+ if (auth.type === "basicAuth" && $("#basic_auth_button").length === 0) {
1610
+ button = new BasicAuthButton({
1611
+ model: auth
1612
+ }).render().el;
1613
+ $('.auth_main_container').append(button);
1614
+ }
1615
+ }
1616
+ }
1421
1617
  $(this.el).html(Handlebars.templates.main(this.model));
1618
+ resources = {};
1619
+ counter = 0;
1422
1620
  _ref3 = this.model.apisArray;
1423
1621
  for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
1424
1622
  resource = _ref3[_i];
1425
- this.addResource(resource);
1623
+ id = resource.name;
1624
+ while (typeof resources[id] !== 'undefined') {
1625
+ id = id + "_" + counter;
1626
+ counter += 1;
1627
+ }
1628
+ resource.id = id;
1629
+ resources[id] = resource;
1630
+ this.addResource(resource, this.model.auths);
1426
1631
  }
1427
1632
  return this;
1428
1633
  };
1429
1634
 
1430
- MainView.prototype.addResource = function(resource) {
1635
+ MainView.prototype.addResource = function(resource, auths) {
1431
1636
  var resourceView;
1637
+ resource.id = resource.id.replace(/\s/g, '_');
1432
1638
  resourceView = new ResourceView({
1433
1639
  model: resource,
1434
1640
  tagName: 'li',
1435
- id: 'resource_' + resource.name,
1436
- className: 'resource'
1641
+ id: 'resource_' + resource.id,
1642
+ className: 'resource',
1643
+ auths: auths,
1644
+ swaggerOptions: this.options.swaggerOptions
1437
1645
  });
1438
1646
  return $('#resources').append(resourceView.render().el);
1439
1647
  };
@@ -1454,17 +1662,40 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1454
1662
  return _ref3;
1455
1663
  }
1456
1664
 
1457
- ResourceView.prototype.initialize = function() {};
1665
+ ResourceView.prototype.initialize = function(opts) {
1666
+ if (opts == null) {
1667
+ opts = {};
1668
+ }
1669
+ this.auths = opts.auths;
1670
+ if ("" === this.model.description) {
1671
+ return this.model.description = null;
1672
+ }
1673
+ };
1458
1674
 
1459
1675
  ResourceView.prototype.render = function() {
1460
- var operation, _i, _len, _ref4;
1676
+ var counter, id, methods, operation, _i, _len, _ref4;
1461
1677
  $(this.el).html(Handlebars.templates.resource(this.model));
1462
- this.number = 0;
1678
+ methods = {};
1679
+ if (this.model.description) {
1680
+ this.model.summary = this.model.description;
1681
+ }
1463
1682
  _ref4 = this.model.operationsArray;
1464
1683
  for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
1465
1684
  operation = _ref4[_i];
1685
+ counter = 0;
1686
+ id = operation.nickname;
1687
+ while (typeof methods[id] !== 'undefined') {
1688
+ id = id + "_" + counter;
1689
+ counter += 1;
1690
+ }
1691
+ methods[id] = operation;
1692
+ operation.nickname = id;
1693
+ operation.parentId = this.model.id;
1466
1694
  this.addOperation(operation);
1467
1695
  }
1696
+ $('.toggleEndpointList', this.el).click(this.callDocs.bind(this, 'toggleEndpointListForResource'));
1697
+ $('.collapseResource', this.el).click(this.callDocs.bind(this, 'collapseOperationsForResource'));
1698
+ $('.expandResource', this.el).click(this.callDocs.bind(this, 'expandOperationsForResource'));
1468
1699
  return this;
1469
1700
  };
1470
1701
 
@@ -1474,12 +1705,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1474
1705
  operationView = new OperationView({
1475
1706
  model: operation,
1476
1707
  tagName: 'li',
1477
- className: 'endpoint'
1708
+ className: 'endpoint',
1709
+ swaggerOptions: this.options.swaggerOptions,
1710
+ auths: this.auths
1478
1711
  });
1479
1712
  $('.endpoints', $(this.el)).append(operationView.render().el);
1480
1713
  return this.number++;
1481
1714
  };
1482
1715
 
1716
+ ResourceView.prototype.callDocs = function(fnName, e) {
1717
+ e.preventDefault();
1718
+ return Docs[fnName](e.currentTarget.getAttribute('data-id'));
1719
+ };
1720
+
1483
1721
  return ResourceView;
1484
1722
 
1485
1723
  })(Backbone.View);
@@ -1498,17 +1736,131 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1498
1736
  'submit .sandbox': 'submitOperation',
1499
1737
  'click .submit': 'submitOperation',
1500
1738
  'click .response_hider': 'hideResponse',
1501
- 'click .toggleOperation': 'toggleOperationContent'
1739
+ 'click .toggleOperation': 'toggleOperationContent',
1740
+ 'mouseenter .api-ic': 'mouseEnter',
1741
+ 'mouseout .api-ic': 'mouseExit'
1502
1742
  };
1503
1743
 
1504
- OperationView.prototype.initialize = function() {};
1744
+ OperationView.prototype.initialize = function(opts) {
1745
+ if (opts == null) {
1746
+ opts = {};
1747
+ }
1748
+ this.auths = opts.auths;
1749
+ return this;
1750
+ };
1751
+
1752
+ OperationView.prototype.mouseEnter = function(e) {
1753
+ var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
1754
+ elem = $(e.currentTarget.parentNode).find('#api_information_panel');
1755
+ x = e.pageX;
1756
+ y = e.pageY;
1757
+ scX = $(window).scrollLeft();
1758
+ scY = $(window).scrollTop();
1759
+ scMaxX = scX + $(window).width();
1760
+ scMaxY = scY + $(window).height();
1761
+ wd = elem.width();
1762
+ hgh = elem.height();
1763
+ if (x + wd > scMaxX) {
1764
+ x = scMaxX - wd;
1765
+ }
1766
+ if (x < scX) {
1767
+ x = scX;
1768
+ }
1769
+ if (y + hgh > scMaxY) {
1770
+ y = scMaxY - hgh;
1771
+ }
1772
+ if (y < scY) {
1773
+ y = scY;
1774
+ }
1775
+ pos = {};
1776
+ pos.top = y;
1777
+ pos.left = x;
1778
+ elem.css(pos);
1779
+ return $(e.currentTarget.parentNode).find('#api_information_panel').show();
1780
+ };
1781
+
1782
+ OperationView.prototype.mouseExit = function(e) {
1783
+ return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
1784
+ };
1505
1785
 
1506
1786
  OperationView.prototype.render = function() {
1507
- var contentTypeModel, isMethodSubmissionSupported, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, type, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
1787
+ var a, auth, auths, code, contentTypeModel, isMethodSubmissionSupported, k, key, o, param, ref, responseContentTypeView, responseSignatureView, schema, schemaObj, signatureModel, statusCode, type, v, value, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref10, _ref11, _ref5, _ref6, _ref7, _ref8, _ref9;
1508
1788
  isMethodSubmissionSupported = true;
1509
1789
  if (!isMethodSubmissionSupported) {
1510
1790
  this.model.isReadOnly = true;
1511
1791
  }
1792
+ this.model.description = this.model.description || this.model.notes;
1793
+ if (this.model.description) {
1794
+ this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
1795
+ }
1796
+ this.model.oauth = null;
1797
+ if (this.model.authorizations) {
1798
+ if (Array.isArray(this.model.authorizations)) {
1799
+ _ref5 = this.model.authorizations;
1800
+ for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1801
+ auths = _ref5[_i];
1802
+ for (key in auths) {
1803
+ auth = auths[key];
1804
+ for (a in this.auths) {
1805
+ auth = this.auths[a];
1806
+ if (auth.type === 'oauth2') {
1807
+ this.model.oauth = {};
1808
+ this.model.oauth.scopes = [];
1809
+ _ref6 = auth.value.scopes;
1810
+ for (k in _ref6) {
1811
+ v = _ref6[k];
1812
+ o = {
1813
+ scope: k,
1814
+ description: v
1815
+ };
1816
+ this.model.oauth.scopes.push(o);
1817
+ }
1818
+ }
1819
+ }
1820
+ }
1821
+ }
1822
+ } else {
1823
+ _ref7 = this.model.authorizations;
1824
+ for (k in _ref7) {
1825
+ v = _ref7[k];
1826
+ if (k === "oauth2") {
1827
+ if (this.model.oauth === null) {
1828
+ this.model.oauth = {};
1829
+ }
1830
+ if (this.model.oauth.scopes === void 0) {
1831
+ this.model.oauth.scopes = [];
1832
+ }
1833
+ for (_j = 0, _len1 = v.length; _j < _len1; _j++) {
1834
+ o = v[_j];
1835
+ this.model.oauth.scopes.push(o);
1836
+ }
1837
+ }
1838
+ }
1839
+ }
1840
+ }
1841
+ if (typeof this.model.responses !== 'undefined') {
1842
+ this.model.responseMessages = [];
1843
+ _ref8 = this.model.responses;
1844
+ for (code in _ref8) {
1845
+ value = _ref8[code];
1846
+ schema = null;
1847
+ schemaObj = this.model.responses[code].schema;
1848
+ if (schemaObj && schemaObj['$ref']) {
1849
+ schema = schemaObj['$ref'];
1850
+ if (schema.indexOf('#/definitions/') === 0) {
1851
+ schema = schema.substring('#/definitions/'.length);
1852
+ }
1853
+ }
1854
+ this.model.responseMessages.push({
1855
+ code: code,
1856
+ message: value.description,
1857
+ responseModel: schema
1858
+ });
1859
+ }
1860
+ }
1861
+ if (typeof this.model.responseMessages === 'undefined') {
1862
+ this.model.responseMessages = [];
1863
+ }
1512
1864
  $(this.el).html(Handlebars.templates.operation(this.model));
1513
1865
  if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
1514
1866
  signatureModel = {
@@ -1522,6 +1874,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1522
1874
  });
1523
1875
  $('.model-signature', $(this.el)).append(responseSignatureView.render().el);
1524
1876
  } else {
1877
+ this.model.responseClassSignature = 'string';
1525
1878
  $('.model-signature', $(this.el)).html(this.model.type);
1526
1879
  }
1527
1880
  contentTypeModel = {
@@ -1529,29 +1882,40 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1529
1882
  };
1530
1883
  contentTypeModel.consumes = this.model.consumes;
1531
1884
  contentTypeModel.produces = this.model.produces;
1532
- _ref5 = this.model.parameters;
1533
- for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1534
- param = _ref5[_i];
1885
+ _ref9 = this.model.parameters;
1886
+ for (_k = 0, _len2 = _ref9.length; _k < _len2; _k++) {
1887
+ param = _ref9[_k];
1535
1888
  type = param.type || param.dataType;
1536
- if (type.toLowerCase() === 'file') {
1889
+ if (typeof type === 'undefined') {
1890
+ schema = param.schema;
1891
+ if (schema && schema['$ref']) {
1892
+ ref = schema['$ref'];
1893
+ if (ref.indexOf('#/definitions/') === 0) {
1894
+ type = ref.substring('#/definitions/'.length);
1895
+ } else {
1896
+ type = ref;
1897
+ }
1898
+ }
1899
+ }
1900
+ if (type && type.toLowerCase() === 'file') {
1537
1901
  if (!contentTypeModel.consumes) {
1538
- log("set content type ");
1539
1902
  contentTypeModel.consumes = 'multipart/form-data';
1540
1903
  }
1541
1904
  }
1905
+ param.type = type;
1542
1906
  }
1543
1907
  responseContentTypeView = new ResponseContentTypeView({
1544
1908
  model: contentTypeModel
1545
1909
  });
1546
1910
  $('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
1547
- _ref6 = this.model.parameters;
1548
- for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1549
- param = _ref6[_j];
1911
+ _ref10 = this.model.parameters;
1912
+ for (_l = 0, _len3 = _ref10.length; _l < _len3; _l++) {
1913
+ param = _ref10[_l];
1550
1914
  this.addParameter(param, contentTypeModel.consumes);
1551
1915
  }
1552
- _ref7 = this.model.responseMessages;
1553
- for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
1554
- statusCode = _ref7[_k];
1916
+ _ref11 = this.model.responseMessages;
1917
+ for (_m = 0, _len4 = _ref11.length; _m < _len4; _m++) {
1918
+ statusCode = _ref11[_m];
1555
1919
  this.addStatusCode(statusCode);
1556
1920
  }
1557
1921
  return this;
@@ -1597,6 +1961,19 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1597
1961
  return error_free = false;
1598
1962
  }
1599
1963
  });
1964
+ form.find("textarea.required").each(function() {
1965
+ var _this = this;
1966
+ $(this).removeClass("error");
1967
+ if (jQuery.trim($(this).val()) === "") {
1968
+ $(this).addClass("error");
1969
+ $(this).wiggle({
1970
+ callback: function() {
1971
+ return $(_this).focus();
1972
+ }
1973
+ });
1974
+ return error_free = false;
1975
+ }
1976
+ });
1600
1977
  if (error_free) {
1601
1978
  map = {};
1602
1979
  opts = {
@@ -1617,7 +1994,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1617
1994
  for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1618
1995
  o = _ref6[_j];
1619
1996
  if ((o.value != null) && jQuery.trim(o.value).length > 0) {
1620
- map["body"] = o.value;
1997
+ map[o.name] = o.value;
1621
1998
  }
1622
1999
  }
1623
2000
  _ref7 = form.find("select");
@@ -1644,9 +2021,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1644
2021
  };
1645
2022
 
1646
2023
  OperationView.prototype.handleFileUpload = function(map, form) {
1647
- var bodyParam, el, headerParams, o, obj, param, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8,
2024
+ var bodyParam, el, headerParams, o, obj, param, params, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8,
1648
2025
  _this = this;
1649
- log("it's a file upload");
1650
2026
  _ref5 = form.serializeArray();
1651
2027
  for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
1652
2028
  o = _ref5[_i];
@@ -1655,11 +2031,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1655
2031
  }
1656
2032
  }
1657
2033
  bodyParam = new FormData();
2034
+ params = 0;
1658
2035
  _ref6 = this.model.parameters;
1659
2036
  for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
1660
2037
  param = _ref6[_j];
1661
2038
  if (param.paramType === 'form') {
1662
- bodyParam.append(param.name, map[param.name]);
2039
+ if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
2040
+ bodyParam.append(param.name, map[param.name]);
2041
+ }
1663
2042
  }
1664
2043
  }
1665
2044
  headerParams = {};
@@ -1670,15 +2049,17 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1670
2049
  headerParams[param.name] = map[param.name];
1671
2050
  }
1672
2051
  }
1673
- log(headerParams);
1674
2052
  _ref8 = form.find('input[type~="file"]');
1675
2053
  for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
1676
2054
  el = _ref8[_l];
1677
- bodyParam.append($(el).attr('name'), el.files[0]);
2055
+ if (typeof el.files[0] !== 'undefined') {
2056
+ bodyParam.append($(el).attr('name'), el.files[0]);
2057
+ params += 1;
2058
+ }
1678
2059
  }
1679
- log(bodyParam);
1680
- this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
1681
- $(".request_url", $(this.el)).html("<pre>" + this.invocationUrl + "</pre>");
2060
+ this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
2061
+ $(".request_url", $(this.el)).html("<pre></pre>");
2062
+ $(".request_url pre", $(this.el)).text(this.invocationUrl);
1682
2063
  obj = {
1683
2064
  type: this.model.method,
1684
2065
  url: this.invocationUrl,
@@ -1700,21 +2081,28 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1700
2081
  if (window.authorizations) {
1701
2082
  window.authorizations.apply(obj);
1702
2083
  }
2084
+ if (params === 0) {
2085
+ obj.data.append("fake", "true");
2086
+ }
1703
2087
  jQuery.ajax(obj);
1704
2088
  return false;
1705
2089
  };
1706
2090
 
1707
2091
  OperationView.prototype.wrap = function(data) {
1708
- var o,
1709
- _this = this;
2092
+ var h, headerArray, headers, i, o, _i, _len;
2093
+ headers = {};
2094
+ headerArray = data.getAllResponseHeaders().split("\r");
2095
+ for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
2096
+ i = headerArray[_i];
2097
+ h = i.split(':');
2098
+ if (h[0] !== void 0 && h[1] !== void 0) {
2099
+ headers[h[0].trim()] = h[1].trim();
2100
+ }
2101
+ }
1710
2102
  o = {};
1711
2103
  o.content = {};
1712
2104
  o.content.data = data.responseText;
1713
- o.getHeaders = function() {
1714
- return {
1715
- "Content-Type": data.headers("Content-Type")
1716
- };
1717
- };
2105
+ o.headers = headers;
1718
2106
  o.request = {};
1719
2107
  o.request.url = this.invocationUrl;
1720
2108
  o.status = data.status;
@@ -1735,7 +2123,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1735
2123
  }
1736
2124
  }
1737
2125
  if (options.length > 0) {
1738
- return options.join(",");
2126
+ return options;
1739
2127
  } else {
1740
2128
  return null;
1741
2129
  }
@@ -1838,42 +2226,68 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1838
2226
  };
1839
2227
 
1840
2228
  OperationView.prototype.showStatus = function(response) {
1841
- var code, content, contentType, headers, pre, response_body;
1842
- content = response.data;
2229
+ var code, content, contentType, e, headers, json, opts, pre, response_body, response_body_el, url;
2230
+ if (response.content === void 0) {
2231
+ content = response.data;
2232
+ url = response.url;
2233
+ } else {
2234
+ content = response.content.data;
2235
+ url = response.request.url;
2236
+ }
1843
2237
  headers = response.headers;
1844
- contentType = headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null;
2238
+ contentType = null;
2239
+ if (headers) {
2240
+ contentType = headers["Content-Type"] || headers["content-type"];
2241
+ if (contentType) {
2242
+ contentType = contentType.split(";")[0].trim();
2243
+ }
2244
+ }
1845
2245
  if (!content) {
1846
2246
  code = $('<code />').text("no content");
1847
2247
  pre = $('<pre class="json" />').append(code);
1848
2248
  } else if (contentType === "application/json" || /\+json$/.test(contentType)) {
1849
- code = $('<code />').text(JSON.stringify(JSON.parse(content), null, " "));
2249
+ json = null;
2250
+ try {
2251
+ json = JSON.stringify(JSON.parse(content), null, " ");
2252
+ } catch (_error) {
2253
+ e = _error;
2254
+ json = "can't parse JSON. Raw result:\n\n" + content;
2255
+ }
2256
+ code = $('<code />').text(json);
1850
2257
  pre = $('<pre class="json" />').append(code);
1851
2258
  } else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
1852
2259
  code = $('<code />').text(this.formatXml(content));
1853
2260
  pre = $('<pre class="xml" />').append(code);
1854
2261
  } else if (contentType === "text/html") {
1855
- code = $('<code />').html(content);
2262
+ code = $('<code />').html(_.escape(content));
1856
2263
  pre = $('<pre class="xml" />').append(code);
1857
2264
  } else if (/^image\//.test(contentType)) {
1858
- pre = $('<img>').attr('src', response.url);
2265
+ pre = $('<img>').attr('src', url);
1859
2266
  } else {
1860
2267
  code = $('<code />').text(content);
1861
2268
  pre = $('<pre class="json" />').append(code);
1862
2269
  }
1863
2270
  response_body = pre;
1864
- $(".request_url", $(this.el)).html("<pre>" + response.url + "</pre>");
2271
+ $(".request_url", $(this.el)).html("<pre></pre>");
2272
+ $(".request_url pre", $(this.el)).text(url);
1865
2273
  $(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
1866
2274
  $(".response_body", $(this.el)).html(response_body);
1867
- $(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>");
2275
+ $(".response_headers", $(this.el)).html("<pre>" + _.escape(JSON.stringify(response.headers, null, " ")).replace(/\n/g, "<br>") + "</pre>");
1868
2276
  $(".response", $(this.el)).slideDown();
1869
2277
  $(".response_hider", $(this.el)).show();
1870
2278
  $(".response_throbber", $(this.el)).hide();
1871
- return hljs.highlightBlock($('.response_body', $(this.el))[0]);
2279
+ response_body_el = $('.response_body', $(this.el))[0];
2280
+ opts = this.options.swaggerOptions;
2281
+ if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
2282
+ return response_body_el;
2283
+ } else {
2284
+ return hljs.highlightBlock(response_body_el);
2285
+ }
1872
2286
  };
1873
2287
 
1874
2288
  OperationView.prototype.toggleOperationContent = function() {
1875
2289
  var elem;
1876
- elem = $('#' + Docs.escapeResourceName(this.model.resourceName) + "_" + this.model.nickname + "_" + this.model.method + "_" + this.model.number + "_content");
2290
+ elem = $('#' + Docs.escapeResourceName(this.model.parentId + "_" + this.model.nickname + "_content"));
1877
2291
  if (elem.is(':visible')) {
1878
2292
  return Docs.collapseOperation(elem);
1879
2293
  } else {
@@ -1896,9 +2310,23 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1896
2310
  StatusCodeView.prototype.initialize = function() {};
1897
2311
 
1898
2312
  StatusCodeView.prototype.render = function() {
1899
- var template;
2313
+ var responseModel, responseModelView, template;
1900
2314
  template = this.template();
1901
2315
  $(this.el).html(template(this.model));
2316
+ if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
2317
+ responseModel = {
2318
+ sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
2319
+ isParam: false,
2320
+ signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
2321
+ };
2322
+ responseModelView = new SignatureView({
2323
+ model: responseModel,
2324
+ tagName: 'div'
2325
+ });
2326
+ $('.model-signature', this.$el).append(responseModelView.render().el);
2327
+ } else {
2328
+ $('.model-signature', this.$el).html('');
2329
+ }
1902
2330
  return this;
1903
2331
  };
1904
2332
 
@@ -1918,17 +2346,42 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
1918
2346
  return _ref6;
1919
2347
  }
1920
2348
 
1921
- ParameterView.prototype.initialize = function() {};
2349
+ ParameterView.prototype.initialize = function() {
2350
+ return Handlebars.registerHelper('isArray', function(param, opts) {
2351
+ if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
2352
+ return opts.fn(this);
2353
+ } else {
2354
+ return opts.inverse(this);
2355
+ }
2356
+ });
2357
+ };
1922
2358
 
1923
2359
  ParameterView.prototype.render = function() {
1924
- var contentTypeModel, isParam, parameterContentTypeView, responseContentTypeView, signatureModel, signatureView, template, type;
2360
+ var contentTypeModel, isParam, parameterContentTypeView, ref, responseContentTypeView, schema, signatureModel, signatureView, template, type;
1925
2361
  type = this.model.type || this.model.dataType;
2362
+ if (typeof type === 'undefined') {
2363
+ schema = this.model.schema;
2364
+ if (schema && schema['$ref']) {
2365
+ ref = schema['$ref'];
2366
+ if (ref.indexOf('#/definitions/') === 0) {
2367
+ type = ref.substring('#/definitions/'.length);
2368
+ } else {
2369
+ type = ref;
2370
+ }
2371
+ }
2372
+ }
2373
+ this.model.type = type;
2374
+ this.model.paramType = this.model["in"] || this.model.paramType;
1926
2375
  if (this.model.paramType === 'body') {
1927
2376
  this.model.isBody = true;
1928
2377
  }
1929
- if (type.toLowerCase() === 'file') {
2378
+ if (type && type.toLowerCase() === 'file') {
1930
2379
  this.model.isFile = true;
1931
2380
  }
2381
+ this.model["default"] = this.model["default"] || this.model.defaultValue;
2382
+ if (this.model.allowableValues) {
2383
+ this.model.isList = true;
2384
+ }
1932
2385
  template = this.template();
1933
2386
  $(this.el).html(template(this.model));
1934
2387
  signatureModel = {
@@ -2011,7 +2464,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
2011
2464
  var template;
2012
2465
  template = this.template();
2013
2466
  $(this.el).html(template(this.model));
2014
- this.switchToDescription();
2467
+ this.switchToSnippet();
2015
2468
  this.isParam = this.model.isParam;
2016
2469
  if (this.isParam) {
2017
2470
  $('.notice', $(this.el)).text('Click to set as parameter value');
@@ -2138,4 +2591,107 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
2138
2591
 
2139
2592
  })(Backbone.View);
2140
2593
 
2141
- }).call(this);
2594
+ ApiKeyButton = (function(_super) {
2595
+ __extends(ApiKeyButton, _super);
2596
+
2597
+ function ApiKeyButton() {
2598
+ _ref11 = ApiKeyButton.__super__.constructor.apply(this, arguments);
2599
+ return _ref11;
2600
+ }
2601
+
2602
+ ApiKeyButton.prototype.initialize = function() {};
2603
+
2604
+ ApiKeyButton.prototype.render = function() {
2605
+ var template;
2606
+ template = this.template();
2607
+ $(this.el).html(template(this.model));
2608
+ return this;
2609
+ };
2610
+
2611
+ ApiKeyButton.prototype.events = {
2612
+ "click #apikey_button": "toggleApiKeyContainer",
2613
+ "click #apply_api_key": "applyApiKey"
2614
+ };
2615
+
2616
+ ApiKeyButton.prototype.applyApiKey = function() {
2617
+ var elem;
2618
+ window.authorizations.add(this.model.name, new ApiKeyAuthorization(this.model.name, $("#input_apiKey_entry").val(), this.model["in"]));
2619
+ window.swaggerUi.load();
2620
+ return elem = $('#apikey_container').show();
2621
+ };
2622
+
2623
+ ApiKeyButton.prototype.toggleApiKeyContainer = function() {
2624
+ var elem;
2625
+ if ($('#apikey_container').length > 0) {
2626
+ elem = $('#apikey_container').first();
2627
+ if (elem.is(':visible')) {
2628
+ return elem.hide();
2629
+ } else {
2630
+ $('.auth_container').hide();
2631
+ return elem.show();
2632
+ }
2633
+ }
2634
+ };
2635
+
2636
+ ApiKeyButton.prototype.template = function() {
2637
+ return Handlebars.templates.apikey_button_view;
2638
+ };
2639
+
2640
+ return ApiKeyButton;
2641
+
2642
+ })(Backbone.View);
2643
+
2644
+ BasicAuthButton = (function(_super) {
2645
+ __extends(BasicAuthButton, _super);
2646
+
2647
+ function BasicAuthButton() {
2648
+ _ref12 = BasicAuthButton.__super__.constructor.apply(this, arguments);
2649
+ return _ref12;
2650
+ }
2651
+
2652
+ BasicAuthButton.prototype.initialize = function() {};
2653
+
2654
+ BasicAuthButton.prototype.render = function() {
2655
+ var template;
2656
+ template = this.template();
2657
+ $(this.el).html(template(this.model));
2658
+ return this;
2659
+ };
2660
+
2661
+ BasicAuthButton.prototype.events = {
2662
+ "click #basic_auth_button": "togglePasswordContainer",
2663
+ "click #apply_basic_auth": "applyPassword"
2664
+ };
2665
+
2666
+ BasicAuthButton.prototype.applyPassword = function() {
2667
+ var elem, password, username;
2668
+ console.log("applying password");
2669
+ username = $(".input_username").val();
2670
+ password = $(".input_password").val();
2671
+ window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
2672
+ window.swaggerUi.load();
2673
+ return elem = $('#basic_auth_container').hide();
2674
+ };
2675
+
2676
+ BasicAuthButton.prototype.togglePasswordContainer = function() {
2677
+ var elem;
2678
+ if ($('#basic_auth_container').length > 0) {
2679
+ elem = $('#basic_auth_container').show();
2680
+ if (elem.is(':visible')) {
2681
+ return elem.slideUp();
2682
+ } else {
2683
+ $('.auth_container').hide();
2684
+ return elem.show();
2685
+ }
2686
+ }
2687
+ };
2688
+
2689
+ BasicAuthButton.prototype.template = function() {
2690
+ return Handlebars.templates.basic_auth_button_view;
2691
+ };
2692
+
2693
+ return BasicAuthButton;
2694
+
2695
+ })(Backbone.View);
2696
+
2697
+ }).call(this);