Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7108afc191 | ||
|
|
0095768ab7 | ||
|
|
31e772f0bf | ||
|
|
b41b200061 | ||
|
|
65a5bc34eb | ||
|
|
cc49093471 | ||
|
|
b336076a19 | ||
|
|
b8943665a2 | ||
|
|
0c0ffc569f | ||
|
|
18ce470f12 | ||
|
|
53593b796e | ||
|
|
2378b176f5 | ||
|
|
7dd5142df2 | ||
|
|
6b400b22fe | ||
|
|
c22d94b940 | ||
|
|
e7b9525911 | ||
|
|
ede80844a5 | ||
|
|
eea0d72a85 | ||
|
|
15acb15af6 | ||
|
|
54d0a8ec09 | ||
|
|
105c516f5f | ||
|
|
542d4fe478 | ||
|
|
97e96ba3d9 | ||
|
|
73eaf9f564 | ||
|
|
fc0ccd4486 | ||
|
|
7f68c35742 | ||
|
|
dc1bc43a19 |
@@ -92,6 +92,8 @@ Create your own fork of [wordnik/swagger-ui](https://github.com/wordnik/swagger-
|
||||
|
||||
To share your changes, [submit a pull request](https://github.com/wordnik/swagger-ui/pull/new/master).
|
||||
|
||||
Since the javascript files are compiled from coffeescript, please submit changes in the *.coffee files! We have to reject changes only in the .js files as they will be lost on each build of the ui.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
|
||||
Vendored
+6
-11
@@ -2,10 +2,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Swagger UI</title>
|
||||
<link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/highlight.default.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<script type="text/javascript" src="lib/shred.bundle.js" /></script>
|
||||
<script type="text/javascript" src="lib/shred.bundle.js"></script>
|
||||
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
||||
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
|
||||
<script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
|
||||
@@ -23,25 +23,20 @@
|
||||
dom_id: "swagger-ui-container",
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
if(console) {
|
||||
console.log("Loaded SwaggerUI")
|
||||
}
|
||||
log("Loaded SwaggerUI")
|
||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
||||
},
|
||||
onFailure: function(data) {
|
||||
if(console) {
|
||||
console.log("Unable to Load SwaggerUI");
|
||||
console.log(data);
|
||||
}
|
||||
log("Unable to Load SwaggerUI");
|
||||
},
|
||||
docExpansion: "none"
|
||||
});
|
||||
|
||||
$('#input_apiKey').change(function() {
|
||||
var key = $('#input_apiKey')[0].value;
|
||||
console.log("key: " + key);
|
||||
log("key: " + key);
|
||||
if(key && key.trim() != "") {
|
||||
console.log("added key " + key);
|
||||
log("added key " + key);
|
||||
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
|
||||
}
|
||||
})
|
||||
|
||||
Vendored
+1237
-1163
File diff suppressed because it is too large
Load Diff
Vendored
+46
-34
@@ -1281,13 +1281,24 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
};
|
||||
|
||||
SwaggerUi.prototype.buildUrl = function(base, url) {
|
||||
var parts;
|
||||
console.log("base is " + base);
|
||||
parts = base.split("/");
|
||||
base = parts[0] + "//" + parts[2];
|
||||
var endOfPath, parts;
|
||||
log("base is " + base);
|
||||
if (url.indexOf("/") === 0) {
|
||||
parts = base.split("/");
|
||||
base = parts[0] + "//" + parts[2];
|
||||
return base + url;
|
||||
} else {
|
||||
endOfPath = base.length;
|
||||
if (base.indexOf("?") > -1) {
|
||||
endOfPath = Math.min(endOfPath, base.indexOf("?"));
|
||||
}
|
||||
if (base.indexOf("#") > -1) {
|
||||
endOfPath = Math.min(endOfPath, base.indexOf("#"));
|
||||
}
|
||||
base = base.substring(0, endOfPath);
|
||||
if (base.indexOf("/", base.length - 1) !== -1) {
|
||||
return base + url;
|
||||
}
|
||||
return base + "/" + url;
|
||||
}
|
||||
};
|
||||
@@ -1435,7 +1446,6 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
|
||||
ResourceView.prototype.render = function() {
|
||||
var operation, _i, _len, _ref4;
|
||||
console.log(this.model.description);
|
||||
$(this.el).html(Handlebars.templates.resource(this.model));
|
||||
this.number = 0;
|
||||
_ref4 = this.model.operationsArray;
|
||||
@@ -1513,7 +1523,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
type = param.type || param.dataType;
|
||||
if (type.toLowerCase() === 'file') {
|
||||
if (!contentTypeModel.consumes) {
|
||||
console.log("set content type ");
|
||||
log("set content type ");
|
||||
contentTypeModel.consumes = 'multipart/form-data';
|
||||
}
|
||||
}
|
||||
@@ -1622,9 +1632,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
};
|
||||
|
||||
OperationView.prototype.handleFileUpload = function(map, form) {
|
||||
var bodyParam, headerParams, o, obj, param, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7,
|
||||
var bodyParam, el, headerParams, o, obj, param, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8,
|
||||
_this = this;
|
||||
console.log("it's a file upload");
|
||||
log("it's a file upload");
|
||||
_ref5 = form.serializeArray();
|
||||
for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
|
||||
o = _ref5[_i];
|
||||
@@ -1648,11 +1658,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
headerParams[param.name] = map[param.name];
|
||||
}
|
||||
}
|
||||
console.log(headerParams);
|
||||
$.each($('input[type~="file"]'), function(i, el) {
|
||||
return bodyParam.append($(el).attr('name'), el.files[0]);
|
||||
});
|
||||
console.log(bodyParam);
|
||||
log(headerParams);
|
||||
_ref8 = form.find('input[type~="file"]');
|
||||
for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
|
||||
el = _ref8[_l];
|
||||
bodyParam.append($(el).attr('name'), el.files[0]);
|
||||
}
|
||||
log(bodyParam);
|
||||
this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), this.model.urlify(map, false)) : this.model.urlify(map, true);
|
||||
$(".request_url", $(this.el)).html("<pre>" + this.invocationUrl + "</pre>");
|
||||
obj = {
|
||||
@@ -1681,16 +1693,16 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
};
|
||||
|
||||
OperationView.prototype.wrap = function(data) {
|
||||
var o,
|
||||
_this = this;
|
||||
var headerArray, headers, i, o, _i, _ref5, _ref6;
|
||||
headers = {};
|
||||
headerArray = data.getAllResponseHeaders().split(":");
|
||||
for (i = _i = 0, _ref5 = headerArray.length / 2, _ref6 = 2.; _ref6 > 0 ? _i <= _ref5 : _i >= _ref5; i = _i += _ref6) {
|
||||
headers[headerArray[i]] = headerArray[i + 1];
|
||||
}
|
||||
o = {};
|
||||
o.content = {};
|
||||
o.content.data = data.responseText;
|
||||
o.getHeaders = function() {
|
||||
return {
|
||||
"Content-Type": data.getResponseHeader("Content-Type")
|
||||
};
|
||||
};
|
||||
o.headers = headers;
|
||||
o.request = {};
|
||||
o.request.url = this.invocationUrl;
|
||||
o.status = data.status;
|
||||
@@ -1813,34 +1825,34 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
return formatted;
|
||||
};
|
||||
|
||||
OperationView.prototype.showStatus = function(data) {
|
||||
OperationView.prototype.showStatus = function(response) {
|
||||
var code, content, contentType, headers, pre, response_body;
|
||||
content = data.content.data;
|
||||
headers = data.getHeaders();
|
||||
contentType = headers["Content-Type"];
|
||||
if (content === void 0) {
|
||||
content = response.data;
|
||||
headers = response.headers;
|
||||
contentType = headers && headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null;
|
||||
if (!content) {
|
||||
code = $('<code />').text("no content");
|
||||
pre = $('<pre class="json" />').append(code);
|
||||
} else if (contentType.indexOf("application/json") === 0 || contentType.indexOf("application/hal+json") === 0) {
|
||||
code = $('<code />').text(JSON.stringify(JSON.parse(content), null, 2));
|
||||
} else if (contentType === "application/json" || /\+json$/.test(contentType)) {
|
||||
code = $('<code />').text(JSON.stringify(JSON.parse(content), null, " "));
|
||||
pre = $('<pre class="json" />').append(code);
|
||||
} else if (contentType.indexOf("application/xml") === 0) {
|
||||
} else if (contentType === "application/xml" || /\+xml$/.test(contentType)) {
|
||||
code = $('<code />').text(this.formatXml(content));
|
||||
pre = $('<pre class="xml" />').append(code);
|
||||
} else if (contentType.indexOf("text/html") === 0) {
|
||||
} else if (contentType === "text/html") {
|
||||
code = $('<code />').html(content);
|
||||
pre = $('<pre class="xml" />').append(code);
|
||||
} else if (contentType.indexOf("image/") === 0) {
|
||||
pre = $('<img>').attr('src', data.request.url);
|
||||
} else if (/^image\//.test(contentType)) {
|
||||
pre = $('<img>').attr('src', response.url);
|
||||
} else {
|
||||
code = $('<code />').text(content);
|
||||
pre = $('<pre class="json" />').append(code);
|
||||
}
|
||||
response_body = pre;
|
||||
$(".request_url", $(this.el)).html("<pre>" + data.request.url + "</pre>");
|
||||
$(".response_code", $(this.el)).html("<pre>" + data.status + "</pre>");
|
||||
$(".request_url", $(this.el)).html("<pre>" + response.url + "</pre>");
|
||||
$(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
|
||||
$(".response_body", $(this.el)).html(response_body);
|
||||
$(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(data.getHeaders(), null, " ").replace(/\n/g, "<br>") + "</pre>");
|
||||
$(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>");
|
||||
$(".response", $(this.el)).slideDown();
|
||||
$(".response_hider", $(this.el)).show();
|
||||
$(".response_throbber", $(this.el)).hide();
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1237
-1163
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "swagger-ui",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.11",
|
||||
"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",
|
||||
@@ -19,7 +19,7 @@
|
||||
"readmeFilename": "README.md",
|
||||
"dependencies": {
|
||||
"coffee-script": "~1.5.0",
|
||||
"swagger-client": "~2.0",
|
||||
"swagger-client": "2.0.18",
|
||||
"handlebars": "~1.0.10",
|
||||
"less": "~1.4.2"
|
||||
}
|
||||
|
||||
@@ -68,14 +68,21 @@ class SwaggerUi extends Backbone.Router
|
||||
)
|
||||
|
||||
buildUrl: (base, url) ->
|
||||
console.log "base is " + base
|
||||
parts = base.split("/")
|
||||
base = parts[0] + "//" + parts[2]
|
||||
log "base is " + base
|
||||
if url.indexOf("/") is 0
|
||||
parts = base.split("/")
|
||||
base = parts[0] + "//" + parts[2]
|
||||
base + url
|
||||
else
|
||||
base + "/" + url
|
||||
|
||||
endOfPath = base.length
|
||||
if base.indexOf("?") > -1
|
||||
endOfPath = Math.min(endOfPath, base.indexOf("?"))
|
||||
if base.indexOf("#") > -1
|
||||
endOfPath = Math.min(endOfPath, base.indexOf("#"))
|
||||
base = base.substring(0, endOfPath);
|
||||
if base.indexOf( "/", base.length - 1 ) isnt -1
|
||||
return base + url
|
||||
return base + "/" + url
|
||||
|
||||
# Shows message on topbar of the ui
|
||||
showMessage: (data = '') ->
|
||||
|
||||
@@ -37,7 +37,7 @@ class OperationView extends Backbone.View
|
||||
type = param.type || param.dataType
|
||||
if type.toLowerCase() == 'file'
|
||||
if !contentTypeModel.consumes
|
||||
console.log "set content type "
|
||||
log "set content type "
|
||||
contentTypeModel.consumes = 'multipart/form-data'
|
||||
|
||||
responseContentTypeView = new ResponseContentTypeView({model: contentTypeModel})
|
||||
@@ -110,7 +110,7 @@ class OperationView extends Backbone.View
|
||||
parent.showCompleteStatus response
|
||||
|
||||
handleFileUpload: (map, form) ->
|
||||
console.log "it's a file upload"
|
||||
log "it's a file upload"
|
||||
for o in form.serializeArray()
|
||||
if(o.value? && jQuery.trim(o.value).length > 0)
|
||||
map[o.name] = o.value
|
||||
@@ -129,13 +129,13 @@ class OperationView extends Backbone.View
|
||||
if param.paramType is 'header'
|
||||
headerParams[param.name] = map[param.name]
|
||||
|
||||
console.log headerParams
|
||||
log headerParams
|
||||
|
||||
# add files
|
||||
$.each $('input[type~="file"]'), (i, el) ->
|
||||
for el in form.find('input[type~="file"]')
|
||||
bodyParam.append($(el).attr('name'), el.files[0])
|
||||
|
||||
console.log(bodyParam)
|
||||
log(bodyParam)
|
||||
|
||||
@invocationUrl =
|
||||
if @model.supportHeaderParams()
|
||||
@@ -169,12 +169,18 @@ class OperationView extends Backbone.View
|
||||
false
|
||||
# end of file-upload nastiness
|
||||
|
||||
# wraps a jquery response as a shred response
|
||||
# wraps a jquery response as a shred response
|
||||
|
||||
wrap: (data) ->
|
||||
headers = {}
|
||||
headerArray = data.getAllResponseHeaders().split(":")
|
||||
for i in [0..headerArray.length/2] by (2)
|
||||
headers[headerArray[i]] = headerArray[i+1]
|
||||
|
||||
o = {}
|
||||
o.content = {}
|
||||
o.content.data = data.responseText
|
||||
o.getHeaders = () => {"Content-Type": data.getResponseHeader("Content-Type")}
|
||||
o.headers = headers
|
||||
o.request = {}
|
||||
o.request.url = @invocationUrl
|
||||
o.status = data.status
|
||||
@@ -271,37 +277,37 @@ class OperationView extends Backbone.View
|
||||
|
||||
|
||||
# puts the response data in UI
|
||||
showStatus: (data) ->
|
||||
content = data.content.data
|
||||
headers = data.getHeaders()
|
||||
showStatus: (response) ->
|
||||
content = response.data
|
||||
headers = response.headers
|
||||
|
||||
# if server is nice, and sends content-type back, we can use it
|
||||
contentType = headers["Content-Type"]
|
||||
contentType = if headers && headers["Content-Type"] then headers["Content-Type"].split(";")[0].trim() else null
|
||||
|
||||
if content == undefined
|
||||
if !content
|
||||
code = $('<code />').text("no content")
|
||||
pre = $('<pre class="json" />').append(code)
|
||||
else if contentType.indexOf("application/json") == 0 || contentType.indexOf("application/hal+json") == 0
|
||||
code = $('<code />').text(JSON.stringify(JSON.parse(content), null, 2))
|
||||
else if contentType is "application/json" || /\+json$/.test(contentType)
|
||||
code = $('<code />').text(JSON.stringify(JSON.parse(content), null, " "))
|
||||
pre = $('<pre class="json" />').append(code)
|
||||
else if contentType.indexOf("application/xml") == 0
|
||||
else if contentType is "application/xml" || /\+xml$/.test(contentType)
|
||||
code = $('<code />').text(@formatXml(content))
|
||||
pre = $('<pre class="xml" />').append(code)
|
||||
else if contentType.indexOf("text/html") == 0
|
||||
else if contentType is "text/html"
|
||||
code = $('<code />').html(content)
|
||||
pre = $('<pre class="xml" />').append(code)
|
||||
else if contentType.indexOf("image/") == 0
|
||||
pre = $('<img>').attr('src',data.request.url)
|
||||
else if /^image\//.test(contentType)
|
||||
pre = $('<img>').attr('src',response.url)
|
||||
else
|
||||
# don't know what to render!
|
||||
code = $('<code />').text(content)
|
||||
pre = $('<pre class="json" />').append(code)
|
||||
|
||||
response_body = pre
|
||||
$(".request_url", $(@el)).html "<pre>" + data.request.url + "</pre>"
|
||||
$(".response_code", $(@el)).html "<pre>" + data.status + "</pre>"
|
||||
$(".request_url", $(@el)).html "<pre>" + response.url + "</pre>"
|
||||
$(".response_code", $(@el)).html "<pre>" + response.status + "</pre>"
|
||||
$(".response_body", $(@el)).html response_body
|
||||
$(".response_headers", $(@el)).html "<pre>" + JSON.stringify(data.getHeaders(), null, " ").replace(/\n/g, "<br>") + "</pre>"
|
||||
$(".response_headers", $(@el)).html "<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>"
|
||||
$(".response", $(@el)).slideDown()
|
||||
$(".response_hider", $(@el)).show()
|
||||
$(".response_throbber", $(@el)).hide()
|
||||
|
||||
@@ -2,7 +2,6 @@ class ResourceView extends Backbone.View
|
||||
initialize: ->
|
||||
|
||||
render: ->
|
||||
console.log @model.description
|
||||
$(@el).html(Handlebars.templates.resource(@model))
|
||||
|
||||
@number = 0
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Swagger UI</title>
|
||||
<link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/highlight.default.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<script type="text/javascript" src="lib/shred.bundle.js" /></script>
|
||||
<script type="text/javascript" src="lib/shred.bundle.js"></script>
|
||||
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
||||
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
|
||||
<script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
|
||||
@@ -23,25 +23,20 @@
|
||||
dom_id: "swagger-ui-container",
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
if(console) {
|
||||
console.log("Loaded SwaggerUI")
|
||||
}
|
||||
log("Loaded SwaggerUI")
|
||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
||||
},
|
||||
onFailure: function(data) {
|
||||
if(console) {
|
||||
console.log("Unable to Load SwaggerUI");
|
||||
console.log(data);
|
||||
}
|
||||
log("Unable to Load SwaggerUI");
|
||||
},
|
||||
docExpansion: "none"
|
||||
});
|
||||
|
||||
$('#input_apiKey').change(function() {
|
||||
var key = $('#input_apiKey')[0].value;
|
||||
console.log("key: " + key);
|
||||
log("key: " + key);
|
||||
if(key && key.trim() != "") {
|
||||
console.log("added key " + key);
|
||||
log("added key " + key);
|
||||
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user