Compare commits

...
3 Commits
Author SHA1 Message Date
Tony Tam 8d0c9107e7 updated version for release 2014-04-29 11:13:43 -07:00
Tony Tam 1f3746a846 rebuilt distro for #331 2014-04-29 09:58:33 -07:00
FilippQoma 9cedc0b4d7 ~ "Error Status Codes" -> "Response Messages"
+ "Response Model" column in OperationView template
+ Response Model in Response Messages
2014-04-29 19:20:31 +03:00
8 changed files with 60 additions and 9 deletions
+13 -1
View File
@@ -1,5 +1,5 @@
// swagger.js
// version 2.0.29
// version 2.0.30
var __bind = function(fn, me){
return function(){
@@ -1475,6 +1475,16 @@ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
}
};
var CookieAuthorization = function(cookie) {
this.cookie = cookie;
}
CookieAuthorization.prototype.apply = function(obj, authorizations) {
obj.cookieJar = obj.cookieJar || CookieJar();
obj.cookieJar.setCookie(this.cookie);
return true;
}
/**
* Password Authorization is a basic auth implementation
*/
@@ -1498,6 +1508,7 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) {
var e = (typeof window !== 'undefined' ? window : exports);
var sampleModels = {};
var cookies = {};
e.SampleModels = sampleModels;
e.SwaggerHttp = SwaggerHttp;
@@ -1505,6 +1516,7 @@ e.SwaggerRequest = SwaggerRequest;
e.authorizations = new SwaggerAuthorizations();
e.ApiKeyAuthorization = ApiKeyAuthorization;
e.PasswordAuthorization = PasswordAuthorization;
e.CookieAuthorization = CookieAuthorization;
e.JQueryHttpClient = JQueryHttpClient;
e.ShredHttpClient = ShredHttpClient;
e.SwaggerOperation = SwaggerOperation;
+18 -4
View File
@@ -1,5 +1,5 @@
// swagger-ui.js
// version 2.0.15
// version 2.0.16
$(function() {
// Helper function for vertically aligning DOM elements
@@ -384,7 +384,7 @@ function program14(depth0,data) {
function program16(depth0,data) {
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 ";
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 ";
}
function program18(depth0,data) {
@@ -1202,7 +1202,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "</td>\n";
buffer += "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
return buffer;
});
})();
@@ -1996,9 +1996,23 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
StatusCodeView.prototype.initialize = function() {};
StatusCodeView.prototype.render = function() {
var template;
var responseModel, responseModelView, template;
template = this.template();
$(this.el).html(template(this.model));
if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
responseModel = {
sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
isParam: false,
signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
};
responseModelView = new SignatureView({
model: responseModel,
tagName: 'div'
});
$('.model-signature', this.$el).append(responseModelView.render().el);
} else {
$('.model-signature', this.$el).html('');
}
return this;
};
+1 -1
View File
File diff suppressed because one or more lines are too long
+13 -1
View File
@@ -1,5 +1,5 @@
// swagger.js
// version 2.0.29
// version 2.0.30
var __bind = function(fn, me){
return function(){
@@ -1475,6 +1475,16 @@ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
}
};
var CookieAuthorization = function(cookie) {
this.cookie = cookie;
}
CookieAuthorization.prototype.apply = function(obj, authorizations) {
obj.cookieJar = obj.cookieJar || CookieJar();
obj.cookieJar.setCookie(this.cookie);
return true;
}
/**
* Password Authorization is a basic auth implementation
*/
@@ -1498,6 +1508,7 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) {
var e = (typeof window !== 'undefined' ? window : exports);
var sampleModels = {};
var cookies = {};
e.SampleModels = sampleModels;
e.SwaggerHttp = SwaggerHttp;
@@ -1505,6 +1516,7 @@ e.SwaggerRequest = SwaggerRequest;
e.authorizations = new SwaggerAuthorizations();
e.ApiKeyAuthorization = ApiKeyAuthorization;
e.PasswordAuthorization = PasswordAuthorization;
e.CookieAuthorization = CookieAuthorization;
e.JQueryHttpClient = JQueryHttpClient;
e.ShredHttpClient = ShredHttpClient;
e.SwaggerOperation = SwaggerOperation;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "2.0.15",
"version": "2.0.16",
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"scripts": {
"build": "PATH=$PATH:./node_modules/.bin cake dist",
@@ -4,6 +4,17 @@ class StatusCodeView extends Backbone.View
render: ->
template = @template()
$(@el).html(template(@model))
if swaggerUi.api.models.hasOwnProperty @model.responseModel
responseModel =
sampleJSON: JSON.stringify(swaggerUi.api.models[@model.responseModel].createJSONSample(), null, 2)
isParam: false
signature: swaggerUi.api.models[@model.responseModel].getMockSignature()
responseModelView = new SignatureView({model: responseModel, tagName: 'div'})
$('.model-signature', @$el).append responseModelView.render().el
else
$('.model-signature', @$el).html ''
@
template: ->
+2 -1
View File
@@ -64,12 +64,13 @@
{{/if}}
{{#if responseMessages}}
<div style='margin:0;padding:0;display:inline'></div>
<h4>Error Status Codes</h4>
<h4>Response Messages</h4>
<table class='fullwidth'>
<thead>
<tr>
<th>HTTP Status Code</th>
<th>Reason</th>
<th>Response Model</th>
</tr>
</thead>
<tbody class="operation-status">
+1
View File
@@ -1,2 +1,3 @@
<td width='15%' class='code'>{{code}}</td>
<td>{{{message}}}</td>
<td width='50%'><span class="model-signature" /></td>