Compare commits

..
43 Commits
Author SHA1 Message Date
Tony Tam 21d8a89316 Merge pull request #947 from swagger-api/develop_2.0
updated client for remote ref support
2015-02-21 23:59:00 -08:00
Tony Tam ff5e84744b updated client for remote ref support 2015-02-21 23:56:06 -08:00
Tony Tam 89d6bede32 updated version 2015-02-21 00:49:02 -08:00
Tony Tam b7430c3132 rebuilt 2015-02-21 00:42:14 -08:00
Tony Tam da2008d605 updated client 2015-02-21 00:42:03 -08:00
Tony Tam 3ecc974ee4 updated version, client 2015-02-21 00:39:24 -08:00
Tony Tam 24b649f2d5 fix for #944, form data with 2.0 spec 2015-02-21 00:32:31 -08:00
Tony Tam 65034e0876 prepare for file upload in swagger-js 2015-02-21 00:26:30 -08:00
Tony Tam 8f99335737 prepare for file upload in swagger-js 2015-02-21 00:25:56 -08:00
Tony Tam b3c31eb631 rebuilt 2015-02-19 23:00:48 -08:00
Tony Tam 048c5dd98f merged from develop_2.0 2015-02-19 23:00:38 -08:00
Tony Tam 1447b865d2 updated version 2015-02-19 22:55:36 -08:00
Tony Tam 75bb7e2521 added tags to test 2015-02-19 22:00:17 -08:00
Tony Tam fb30579387 updated client 2015-02-19 21:50:56 -08:00
Ron fbd7f83e5b Update README.md 2015-02-19 19:51:10 +02:00
Tony Tam 14f27da114 rebuild 2015-02-18 21:34:33 -08:00
Tony Tam 29b3d68010 merged from develop_2.0 2015-02-18 21:30:26 -08:00
Tony Tam 7596ab0c9c rebuilt 2015-02-18 21:20:15 -08:00
Tony Tam b5ebe4f796 rebuilt 2015-02-18 21:19:14 -08:00
Tony Tam 2dad51f6b1 updated from master 2015-02-18 21:18:53 -08:00
Tony Tam f1263cac9b removed bin folder 2015-02-18 21:18:40 -08:00
Tony Tam c2c6c19179 moved from render to init method 2015-02-18 21:05:36 -08:00
Tony Tam 0afc64d6aa reduced timeout 2015-02-18 21:05:16 -08:00
Tony Tam e926091443 Merge pull request #928 from entaksi/develop_2.0
Fix OAuth2 login when no scope is defined
2015-02-12 16:25:15 -08:00
Tony Tam 34787348a9 test for #932 2015-02-12 14:06:22 -08:00
Tony Tam 283647d41d updated version 2015-02-12 11:28:34 -08:00
Tony Tam 23daf1afdb rebuilt 2015-02-12 11:27:25 -08:00
Tony Tam 7ff221485b updated client lib 2015-02-12 11:27:18 -08:00
Tony Tam 1fbbabe974 fixed rendering to support latest client for #932 2015-02-12 11:26:21 -08:00
Stefano Travelli a5f1eeae04 Fix OAuth2 login when no scope is defined 2015-02-12 11:17:55 +01:00
Tony Tam f6be07ff9a Merge pull request #925 from swagger-api/feature/legacy-cleanup
Feature/legacy cleanup
2015-02-11 21:39:59 -08:00
Tony Tam fd9fbd61e7 updated versions 2015-02-11 21:35:52 -08:00
Tony Tam 9ce5187312 updated files 2015-02-10 12:49:36 -08:00
Tony Tam d489c1e429 Merge pull request #920 from entaksi/master
Include redirect_uri in access token request for OAuth2 authentication.
2015-02-10 08:26:33 -08:00
Stefano Travelli b975d4fee8 Include redirect_uri in access token request for OAuth2 authentication. 2015-02-10 14:43:51 +01:00
Tony Tam 61a87b8fd7 updated client, version 2015-02-09 10:22:44 -08:00
Tony Tam 002a63ce26 Merge branch 'master' of github.com:swagger-api/swagger-ui 2015-02-06 13:33:05 -08:00
Tony Tam da4320ec24 added fix for #916 by copying identifiers instead of using references 2015-02-06 13:32:50 -08:00
Tony Tam c85f11f62e Merge pull request #910 from coolfrood/master
fixes to docker installation
2015-02-05 08:33:36 -08:00
Akshat Aranya 235e0c00da fixes to docker installation 2015-02-05 08:28:36 -08:00
Ron 384ffb7e1f Update README.md 2015-02-01 12:16:13 +02:00
Ron fc6fdc709d Update README.md 2015-02-01 12:13:31 +02:00
Ron ff7e2712f4 Update LICENSE 2015-02-01 12:07:46 +02:00
17 changed files with 1187 additions and 413 deletions
+1 -3
View File
@@ -19,6 +19,4 @@ WORKDIR /build
ADD package.json /build/package.json
RUN npm install
ADD . /build
CMD PATH=$PATH:node_modules/.bin cake dist
=======
CMD PATH=$PATH:node_modules/.bin cake dist
CMD ./node_modules/gulp/bin/gulp.js serve
+7 -5
View File
@@ -20,7 +20,7 @@ The Swagger Specification has undergone 4 revisions since initial creation in 20
Swagger UI Version | Release Date | Swagger Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------
2.1.0-M1 | 2015-01-31 | 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-ui) |
2.1.5-M1 | 2015-02-18 | 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-ui) |
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) |
1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) |
@@ -46,11 +46,12 @@ To build swagger-ui using a docker container:
```
docker build -t swagger-ui-builder .
docker run -v $PWD/dist:/build/dist swagger-ui-builder
docker run -p 127.0.0.1:8080:8080 swagger-ui-builder
```
This will start Swagger UI at `http://localhost:8080`.
### Use
Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.wordnik.com/v2/swagger.json) service and show its APIs. You can enter your own server url and click explore to view the API.
Once you open the Swagger UI, it will load the [Swagger Petstore](http://petstore.swagger.io/v2/swagger.json) service and show its APIs. You can enter your own server url and click explore to view the API.
### Customize
You may choose to customize Swagger UI for your organization. Here is an overview of whats in its various directories:
@@ -69,7 +70,7 @@ To use swagger-ui you should take a look at the [source of swagger-ui html page]
```javascript
window.swaggerUi = new SwaggerUi({
url:"http://petstore.swagger.wordnik.com/v2/swagger.json",
url:"http://petstore.swagger.io/v2/swagger.json",
dom_id:"swagger-ui-container"
});
@@ -90,6 +91,7 @@ sorter | Apply a sort to the API list. It can be 'alpha' (sort paths alphanumeri
onComplete | This is a callback function parameter which can be passed to be notified of when SwaggerUI has completed rendering successfully.
onFailure | This is a callback function parameter which can be passed to be notified of when SwaggerUI encountered a failure was unable to render.
highlightSizeThreshold | Any size response below this threshold will be highlighted syntactically, attempting to highlight large responses can lead to browser hangs, not including a threshold will default to highlight all returned responses.
supportedSubmitMethods | An array of of the HTTP operations that will have the 'Try it out!` option. An empty array disables all operations. This does not filter the operations from the display.
* All other parameters are explained in greater detail below
@@ -145,7 +147,7 @@ You can verify CORS support with one of three techniques:
- Curl your API and inspect the headers. For instance:
```bash
$ curl -I "http://petstore.swagger.wordnik.com/v2/swagger.json"
$ curl -I "http://petstore.swagger.io/v2/swagger.json"
HTTP/1.1 200 OK
Date: Sat, 31 Jan 2015 23:05:44 GMT
Access-Control-Allow-Origin: *
+2 -2
View File
@@ -28,12 +28,12 @@
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
} else {
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
url = "http://petstore.swagger.io/v2/swagger.json";
}
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
onComplete: function(swaggerApi, swaggerUi){
if(typeof initOAuth == "function") {
/*
+478 -116
View File
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -4,6 +4,7 @@ var popupDialog;
var clientId;
var realm;
var oauth2KeyName;
var redirect_uri;
function handleLogin() {
var scopes = [];
@@ -141,6 +142,8 @@ function handleLogin() {
window.enabledScopes=scopes;
redirect_uri = redirectUrl;
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
url += '&realm=' + encodeURIComponent(realm);
url += '&client_id=' + encodeURIComponent(clientId);
@@ -199,7 +202,8 @@ function processOAuthCode(data) {
var params = {
'client_id': clientId,
'code': data.code,
'grant_type': 'authorization_code'
'grant_type': 'authorization_code',
'redirect_uri': redirect_uri
}
$.ajax(
{
+154 -152
View File
@@ -1,6 +1,6 @@
/**
* swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
* @version v2.1.1-M1
* @version v2.1.8-M1
* @link http://swagger.io
* @license Apache 2.0
*/
@@ -199,6 +199,14 @@ var Docs = {
}
};
this["Handlebars"] = this["Handlebars"] || {};
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>"
+ escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
+ "</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";
},"useData":true});
var SwaggerUi,
__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; },
__hasProp = {}.hasOwnProperty;
@@ -284,8 +292,7 @@ SwaggerUi = (function(_super) {
}
this.options.url = url;
this.headerView.update(url);
this.api = new SwaggerClient(this.options);
return this.api.build();
return this.api = new SwaggerClient(this.options);
};
SwaggerUi.prototype.collapseAll = function() {
@@ -323,7 +330,7 @@ SwaggerUi = (function(_super) {
return function() {
return Docs.shebang();
};
})(this), 400);
})(this), 100);
};
SwaggerUi.prototype.buildUrl = function(base, url) {
@@ -386,22 +393,35 @@ SwaggerUi = (function(_super) {
window.SwaggerUi = SwaggerUi;
this["Handlebars"] = this["Handlebars"] || {};
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return "<!--div class='auth_button' id='apikey_button'><img class='auth_icon' alt='apply api key' src='images/apikey.jpeg'></div-->\n<div class='auth_container' id='apikey_container'>\n <div class='key_input_container'>\n <div class='auth_label'>"
+ escapeExpression(((helper = (helper = helpers.keyName || (depth0 != null ? depth0.keyName : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"keyName","hash":{},"data":data}) : helper)))
+ "</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";
},"useData":true});
this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\">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";
},"useData":true});
Handlebars.registerHelper('sanitize', function(html) {
html = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
return new Handlebars.SafeString(html);
});
this["Handlebars"]["templates"]["basic_auth_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
return "<div class='auth_button' id='basic_auth_button'><img class='auth_icon' src='images/password.jpeg'></div>\n<div class='auth_container' id='basic_auth_container'>\n <div class='key_input_container'>\n <div class=\"auth_label\">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";
},"useData":true});
this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, buffer = " <option value=\"";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
buffer += "\">";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + "</option>\n";
},"4":function(depth0,helpers,partials,data) {
return " <option value=\"application/json\">application/json</option>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
},"useData":true});
var ApiKeyButton,
__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; },
__hasProp = {}.hasOwnProperty;
@@ -455,82 +475,6 @@ ApiKeyButton = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, buffer = " <option value=\"";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
buffer += "\">";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + "</option>\n";
},"4":function(depth0,helpers,partials,data) {
return " <option value=\"application/json\">application/json</option>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = "<label for=\"contentType\"></label>\n<select name=\"contentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.produces : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
},"useData":true});
var BasicAuthButton,
__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; },
__hasProp = {}.hasOwnProperty;
BasicAuthButton = (function(_super) {
__extends(BasicAuthButton, _super);
function BasicAuthButton() {
return BasicAuthButton.__super__.constructor.apply(this, arguments);
}
BasicAuthButton.prototype.initialize = function() {};
BasicAuthButton.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
return this;
};
BasicAuthButton.prototype.events = {
"click #basic_auth_button": "togglePasswordContainer",
"click #apply_basic_auth": "applyPassword"
};
BasicAuthButton.prototype.applyPassword = function() {
var elem, password, username;
username = $(".input_username").val();
password = $(".input_password").val();
window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
window.swaggerUi.load();
return elem = $('#basic_auth_container').hide();
};
BasicAuthButton.prototype.togglePasswordContainer = function() {
var elem;
if ($('#basic_auth_container').length > 0) {
elem = $('#basic_auth_container').show();
if (elem.is(':visible')) {
return elem.slideUp();
} else {
$('.auth_container').hide();
return elem.show();
}
}
};
BasicAuthButton.prototype.template = function() {
return Handlebars.templates.basic_auth_button_view;
};
return BasicAuthButton;
})(Backbone.View);
this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
+ escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
@@ -614,6 +558,61 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
if (stack1 != null) { buffer += stack1; }
return buffer + " </h4>\n </div>\n</div>\n";
},"useData":true});
var BasicAuthButton,
__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; },
__hasProp = {}.hasOwnProperty;
BasicAuthButton = (function(_super) {
__extends(BasicAuthButton, _super);
function BasicAuthButton() {
return BasicAuthButton.__super__.constructor.apply(this, arguments);
}
BasicAuthButton.prototype.initialize = function() {};
BasicAuthButton.prototype.render = function() {
var template;
template = this.template();
$(this.el).html(template(this.model));
return this;
};
BasicAuthButton.prototype.events = {
"click #basic_auth_button": "togglePasswordContainer",
"click #apply_basic_auth": "applyPassword"
};
BasicAuthButton.prototype.applyPassword = function() {
var elem, password, username;
username = $(".input_username").val();
password = $(".input_password").val();
window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
window.swaggerUi.load();
return elem = $('#basic_auth_container').hide();
};
BasicAuthButton.prototype.togglePasswordContainer = function() {
var elem;
if ($('#basic_auth_container').length > 0) {
elem = $('#basic_auth_container').show();
if (elem.is(':visible')) {
return elem.slideUp();
} else {
$('.auth_container').hide();
return elem.show();
}
}
};
BasicAuthButton.prototype.template = function() {
return Handlebars.templates.basic_auth_button_view;
};
return BasicAuthButton;
})(Backbone.View);
this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
return "deprecated";
},"3":function(depth0,helpers,partials,data) {
@@ -1076,6 +1075,39 @@ this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":fun
if (stack1 != null) { buffer += stack1; }
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
},"useData":true});
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ "'>"
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ "</textarea>\n";
},"3":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"4":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " "
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ "\n";
},"6":function(depth0,helpers,partials,data) {
return " (empty)\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ "</td>\n<td>\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += "</td>\n<td class=\"markdown\">";
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
if (stack1 != null) { buffer += stack1; }
buffer += "</td>\n<td>";
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
if (stack1 != null) { buffer += stack1; }
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
},"useData":true});
var OperationView,
__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; },
__hasProp = {}.hasOwnProperty;
@@ -1103,6 +1135,8 @@ OperationView = (function(_super) {
opts = {};
}
this.auths = opts.auths;
this.parentId = this.model.parentId;
this.nickname = this.model.nickname;
return this;
};
@@ -1364,6 +1398,7 @@ OperationView = (function(_super) {
map[o.name] = o.value;
}
if (o.type === "file") {
map[o.name] = o.files[0];
isFileUpload = true;
}
}
@@ -1411,7 +1446,7 @@ OperationView = (function(_super) {
_ref1 = this.model.parameters;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
param = _ref1[_j];
if (param.paramType === 'form') {
if (param.paramType === 'form' || param["in"] === 'formData') {
if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
bodyParam.append(param.name, map[param.name]);
}
@@ -1675,7 +1710,7 @@ OperationView = (function(_super) {
OperationView.prototype.toggleOperationContent = function() {
var elem;
elem = $('#' + Docs.escapeResourceName(this.model.parentId + "_" + this.model.nickname + "_content"));
elem = $('#' + Docs.escapeResourceName(this.parentId + "_" + this.nickname + "_content"));
if (elem.is(':visible')) {
return Docs.collapseOperation(elem);
} else {
@@ -1687,39 +1722,6 @@ OperationView = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ "'>"
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ "</textarea>\n";
},"3":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"4":function(depth0,helpers,partials,data) {
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
return " "
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
+ "\n";
},"6":function(depth0,helpers,partials,data) {
return " (empty)\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
+ "</td>\n<td>\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
if (stack1 != null) { buffer += stack1; }
buffer += "</td>\n<td class=\"markdown\">";
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
if (stack1 != null) { buffer += stack1; }
buffer += "</td>\n<td>";
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
if (stack1 != null) { buffer += stack1; }
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
},"useData":true});
var ParameterContentTypeView,
__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; },
__hasProp = {}.hasOwnProperty;
@@ -1817,6 +1819,27 @@ this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":fun
if (stack1 != null) { buffer += stack1; }
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
},"useData":true});
this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, buffer = " <option value=\"";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
buffer += "\">";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + "</option>\n";
},"4":function(depth0,helpers,partials,data) {
return " <option value=\"application/json\">application/json</option>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
},"useData":true});
var ParameterView,
__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; },
__hasProp = {}.hasOwnProperty;
@@ -1926,27 +1949,6 @@ ParameterView = (function(_super) {
})(Backbone.View);
this["Handlebars"]["templates"]["parameter_content_type"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
var stack1, buffer = "";
stack1 = helpers.each.call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"each","hash":{},"fn":this.program(2, data),"inverse":this.noop,"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer;
},"2":function(depth0,helpers,partials,data) {
var stack1, lambda=this.lambda, buffer = " <option value=\"";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
buffer += "\">";
stack1 = lambda(depth0, depth0);
if (stack1 != null) { buffer += stack1; }
return buffer + "</option>\n";
},"4":function(depth0,helpers,partials,data) {
return " <option value=\"application/json\">application/json</option>\n";
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
var stack1, buffer = "<label for=\"parameterContentType\"></label>\n<select name=\"parameterContentType\">\n";
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.consumes : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(4, data),"data":data});
if (stack1 != null) { buffer += stack1; }
return buffer + "</select>\n";
},"useData":true});
var ResourceView,
__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; },
__hasProp = {}.hasOwnProperty;
@@ -1964,17 +1966,17 @@ ResourceView = (function(_super) {
}
this.auths = opts.auths;
if ("" === this.model.description) {
return this.model.description = null;
this.model.description = null;
}
if (this.model.description != null) {
return this.model.summary = this.model.description;
}
};
ResourceView.prototype.render = function() {
var counter, id, methods, operation, _i, _len, _ref;
$(this.el).html(Handlebars.templates.resource(this.model));
methods = {};
if (this.model.description) {
this.model.summary = this.model.description;
}
$(this.el).html(Handlebars.templates.resource(this.model));
_ref = this.model.operationsArray;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
operation = _ref[_i];
+2 -2
View File
File diff suppressed because one or more lines are too long
+478 -116
View File
File diff suppressed because it is too large Load Diff
+5 -1
View File
@@ -4,6 +4,7 @@ var popupDialog;
var clientId;
var realm;
var oauth2KeyName;
var redirect_uri;
function handleLogin() {
var scopes = [];
@@ -141,6 +142,8 @@ function handleLogin() {
window.enabledScopes=scopes;
redirect_uri = redirectUrl;
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
url += '&realm=' + encodeURIComponent(realm);
url += '&client_id=' + encodeURIComponent(clientId);
@@ -199,7 +202,8 @@ function processOAuthCode(data) {
var params = {
'client_id': clientId,
'code': data.code,
'grant_type': 'authorization_code'
'grant_type': 'authorization_code',
'redirect_uri': redirect_uri
}
$.ajax(
{
+2 -2
View File
@@ -2,7 +2,7 @@
"name": "swagger-ui",
"author": "Tony Tam <fehguy@gmail.com>",
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"version": "2.1.1-M1",
"version": "2.1.8-M1",
"homepage": "http://swagger.io",
"license": "Apache 2.0",
"scripts": {
@@ -18,7 +18,7 @@
"dependencies": {
"shred": "0.8.10",
"btoa": "1.1.1",
"swagger-client": "2.1.1-M1"
"swagger-client": "2.1.9-M1"
},
"devDependencies": {
"chai": "^1.10.0",
+1 -2
View File
@@ -62,7 +62,6 @@ class SwaggerUi extends Backbone.Router
@headerView.update(url)
@api = new SwaggerClient(@options)
@api.build()
# collapse all sections
collapseAll:() ->
@@ -90,7 +89,7 @@ class SwaggerUi extends Backbone.Router
setTimeout(
=>
Docs.shebang()
400
100
)
buildUrl: (base, url) ->
@@ -12,7 +12,8 @@ class OperationView extends Backbone.View
initialize: (opts={}) ->
@auths = opts.auths
@parentId = @model.parentId
@nickname = @model.nickname
@
mouseEnter: (e) ->
@@ -194,6 +195,7 @@ class OperationView extends Backbone.View
if(o.value? && jQuery.trim(o.value).length > 0)
map[o.name] = o.value
if o.type is "file"
map[o.name] = o.files[0]
isFileUpload = true
for o in form.find("textarea")
@@ -228,7 +230,7 @@ class OperationView extends Backbone.View
# add params
for param in @model.parameters
if param.paramType is 'form'
if param.paramType is 'form' or param.in is 'formData'
if param.type.toLowerCase() isnt 'file' and map[param.name] != undefined
bodyParam.append(param.name, map[param.name])
@@ -452,5 +454,5 @@ class OperationView extends Backbone.View
if opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold then response_body_el else hljs.highlightBlock(response_body_el)
toggleOperationContent: ->
elem = $('#' + Docs.escapeResourceName(@model.parentId + "_" + @model.nickname + "_content"))
elem = $('#' + Docs.escapeResourceName(@parentId + "_" + @nickname + "_content"))
if elem.is(':visible') then Docs.collapseOperation(elem) else Docs.expandOperation(elem)
@@ -1,16 +1,17 @@
class ResourceView extends Backbone.View
initialize: (opts={}) ->
@auths = opts.auths
if "" is @model.description
if "" is @model.description
@model.description = null
if @model.description?
@model.summary = @model.description
render: ->
$(@el).html(Handlebars.templates.resource(@model))
methods = {}
if @model.description
@model.summary = @model.description
$(@el).html(Handlebars.templates.resource(@model))
# Render each operation
for operation in @model.operationsArray
counter = 0
+2 -2
View File
@@ -28,12 +28,12 @@
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
} else {
url = "http://petstore.swagger.wordnik.com/v2/swagger.json";
url = "http://petstore.swagger.io/v2/swagger.json";
}
window.swaggerUi = new SwaggerUi({
url: url,
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
onComplete: function(swaggerApi, swaggerUi){
if(typeof initOAuth == "function") {
/*
+9 -1
View File
@@ -24,7 +24,7 @@ var elements = [
];
describe('swagger 1.x spec tests', function (done) {
this.timeout(10 * 10000);
this.timeout(10 * 1000);
var swaggerUI, specServer, driver;
before(function () {
@@ -89,6 +89,14 @@ describe('swagger 1.x spec tests', function (done) {
});
});
it('should find the pet resource description', function(done){
var locator = webdriver.By.xpath("//div[contains(., 'Operations about pets')]");
driver.findElements(locator).then(function (elements) {
expect(elements.length).to.not.equal(0);
done();
});
});
it('should find the user link', function(done){
var locator = webdriver.By.xpath("//*[@data-id='user']");
driver.isElementPresent(locator).then(function (isPresent) {
+8
View File
@@ -105,6 +105,14 @@ describe('swagger 2.0 spec tests', function (done) {
});
});
it('should find the pet resource description', function(done){
var locator = webdriver.By.xpath("//div[contains(., 'Everything about your Pets')]");
driver.findElements(locator).then(function (elements) {
expect(elements.length).to.not.equal(0);
done();
});
});
it('should find the user link', function(done){
var locator = webdriver.By.xpath("//*[@data-id='user']");
driver.isElementPresent(locator).then(function (isPresent) {
+22
View File
@@ -20,6 +20,28 @@
"schemes": [
"http"
],
"tags": [
{
"name": "user",
"description": "Operations about user"
},
{
"name": "store",
"description": "Access to Petstore orders",
"externalDocs": {
"description": "Find out more",
"url": "http://swagger.io"
}
},
{
"name": "pet",
"description": "Everything about your Pets",
"externalDocs": {
"description": "Find out more",
"url": "http://swagger.io"
}
}
],
"paths": {
"/pet": {
"post": {