Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swagger-ui

Package Overview
Dependencies
Maintainers
1
Versions
394
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swagger-ui - npm Package Compare versions

Comparing version 2.1.4-M1 to 2.1.4-M2

.gitattributes

29

dist/lib/swagger-oauth.js

@@ -100,3 +100,4 @@ var appName;

var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
var url = null;

@@ -107,3 +108,3 @@

var flow = authSchemes[key].flow;
if(authSchemes[key].type === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {

@@ -113,3 +114,3 @@ var dets = authSchemes[key];

window.swaggerUi.tokenName = dets.tokenName || 'access_token';
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
}

@@ -141,3 +142,3 @@ else if(authSchemes[key].grantTypes) {

var scope = $(o[k]).attr('scope');
if (scopes.indexOf(scope) === -1)

@@ -147,2 +148,5 @@ scopes.push(scope);

// Implicit auth recommends a state parameter.
var state = Math.random ();
window.enabledScopes=scopes;

@@ -155,3 +159,4 @@

url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopes);
url += '&scope=' + encodeURIComponent(scopes.join(' '));
url += '&state=' + encodeURIComponent(state);

@@ -207,3 +212,3 @@ window.open(url);

function processOAuthCode(data) {
window.processOAuthCode = function processOAuthCode(data) {
var params = {

@@ -220,7 +225,7 @@ 'client_id': clientId,

data: params,
success:function(data, textStatus, jqXHR)
success:function(data, textStatus, jqXHR)
{
onOAuthComplete(data);
},
error: function(jqXHR, textStatus, errorThrown)
error: function(jqXHR, textStatus, errorThrown)
{

@@ -232,3 +237,3 @@ onOAuthComplete("");

function onOAuthComplete(token) {
window.onOAuthComplete = function onOAuthComplete(token) {
if(token) {

@@ -280,10 +285,10 @@ if(token.error) {

$(o).find('.api-ic').removeClass('ic-warning');
$(o).find('.api-ic').removeClass('ic-error');
$(o).find('.api-ic').removeClass('ic-error');
}
}
});
window.authorizations.add(oauth2KeyName, new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
window.swaggerUi.api.clientAuthorizations.add(oauth2KeyName, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
}
}
}
}
}

@@ -5,5 +5,3 @@ 'use strict';

var es = require('event-stream');
var gutil = require('gulp-util');
var clean = require('gulp-clean');
var coffee = require('gulp-coffee');
var concat = require('gulp-concat');

@@ -20,2 +18,4 @@ var uglify = require('gulp-uglify');

var pkg = require('./package.json');
var order = require('gulp-order');
var jshint = require('gulp-jshint');
var banner = ['/**',

@@ -36,3 +36,3 @@ ' * <%= pkg.name %> - <%= pkg.description %>',

.pipe(clean({force: true}))
.on('error', gutil.log);
.on('error', log);
});

@@ -52,14 +52,13 @@

}))
.on('error', gutil.log);
.on('error', log);
}
/**
* Processes CoffeeScript files
* JShint all *.js files
*/
function coffeescript () {
return gulp
.src(['./src/main/coffeescript/**/*.coffee'])
.pipe(coffee({bare: true}))
.on('error', gutil.log);
}
gulp.task('lint', function () {
return gulp.src('./src/main/javascript/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});

@@ -69,15 +68,20 @@ /**

*/
gulp.task('dist', ['clean'], function() {
gulp.task('dist', ['clean','lint'], function() {
return es.merge(
gulp.src('./src/main/javascript/doc.js'),
coffeescript(),
gulp.src([
'./src/main/javascript/**/*.js',
'./node_modules/swagger-client/browser/swagger-client.js'
]),
templates()
)
.pipe(order(['scripts.js', 'templates.js']))
.pipe(concat('swagger-ui.js'))
.pipe(wrap('(function(){<%= contents %>}).call(this);'))
.pipe(header(banner, { pkg: pkg } ))
.pipe(gulp.dest('./dist'))
.pipe(uglify())
.on('error', log)
.pipe(rename({extname: '.min.js'}))
.on('error', gutil.log)
.on('error', log)
.pipe(gulp.dest('./dist'))

@@ -95,6 +99,7 @@ .pipe(connect.reload());

'./src/main/less/screen.less',
'./src/main/less/print.less',
'./src/main/less/reset.less'
])
.pipe(less())
.on('error', gutil.log)
.on('error', log)
.pipe(gulp.dest('./src/main/html/css/'))

@@ -112,5 +117,5 @@ .pipe(connect.reload());

gulp
.src(['./lib/**/*.js'])
.src(['./lib/**/*.{js,map}'])
.pipe(gulp.dest('./dist/lib'))
.on('error', gutil.log)
.on('error', log);

@@ -121,3 +126,3 @@ // copy all files inside html folder

.pipe(gulp.dest('./dist'))
.on('error', gutil.log)
.on('error', log);
});

@@ -129,3 +134,3 @@

gulp.task('watch', function() {
return watch(['./src/**/*.{coffee,js,less}'], function() {
return watch(['./src/**/*.{js,less,handlebars}'], function() {
gulp.start('default');

@@ -145,4 +150,8 @@ });

function log(error) {
console.error(error.toString && error.toString());
}
gulp.task('default', ['dist', 'copy']);
gulp.task('serve', ['connect', 'watch'])
gulp.task('serve', ['connect', 'watch']);

@@ -100,3 +100,4 @@ var appName;

var pathname = location.pathname.substring(0, location.pathname.lastIndexOf("/"));
var redirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
var defaultRedirectUrl = host.protocol + '//' + host.host + pathname + '/o2c.html';
var redirectUrl = window.oAuthRedirectUrl || defaultRedirectUrl;
var url = null;

@@ -107,3 +108,3 @@

var flow = authSchemes[key].flow;
if(authSchemes[key].type === 'oauth2' && flow && (flow === 'implicit' || flow === 'accessCode')) {

@@ -113,3 +114,3 @@ var dets = authSchemes[key];

window.swaggerUi.tokenName = dets.tokenName || 'access_token';
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
window.swaggerUi.tokenUrl = (flow === 'accessCode' ? dets.tokenUrl : null);
}

@@ -141,3 +142,3 @@ else if(authSchemes[key].grantTypes) {

var scope = $(o[k]).attr('scope');
if (scopes.indexOf(scope) === -1)

@@ -147,2 +148,5 @@ scopes.push(scope);

// Implicit auth recommends a state parameter.
var state = Math.random ();
window.enabledScopes=scopes;

@@ -155,3 +159,4 @@

url += '&client_id=' + encodeURIComponent(clientId);
url += '&scope=' + encodeURIComponent(scopes);
url += '&scope=' + encodeURIComponent(scopes.join(' '));
url += '&state=' + encodeURIComponent(state);

@@ -207,3 +212,3 @@ window.open(url);

function processOAuthCode(data) {
window.processOAuthCode = function processOAuthCode(data) {
var params = {

@@ -220,7 +225,7 @@ 'client_id': clientId,

data: params,
success:function(data, textStatus, jqXHR)
success:function(data, textStatus, jqXHR)
{
onOAuthComplete(data);
},
error: function(jqXHR, textStatus, errorThrown)
error: function(jqXHR, textStatus, errorThrown)
{

@@ -232,3 +237,3 @@ onOAuthComplete("");

function onOAuthComplete(token) {
window.onOAuthComplete = function onOAuthComplete(token) {
if(token) {

@@ -280,10 +285,10 @@ if(token.error) {

$(o).find('.api-ic').removeClass('ic-warning');
$(o).find('.api-ic').removeClass('ic-error');
$(o).find('.api-ic').removeClass('ic-error');
}
}
});
window.authorizations.add(oauth2KeyName, new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
window.swaggerUi.api.clientAuthorizations.add(oauth2KeyName, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
}
}
}
}
}
{
"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.4-M1",
"contributors": [
{
"name": "Mohsen Azimi",
"email": "me@azimi.me"
}
],
"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.4-M2",
"homepage": "http://swagger.io",
"license": "Apache 2.0",
"main": "dist/swagger-ui.js",
"scripts": {
"build": "./node_modules/gulp/bin/gulp.js;",
"serve": "./node_modules/gulp/bin/gulp.js serve;",
"test": "./node_modules/gulp/bin/gulp.js; ./node_modules/mocha/bin/mocha"
"build": "gulp",
"serve": "gulp serve",
"prejshint": "gulp",
"jshint": "jshint .",
"pretest": "npm run jshint",
"test": "mocha"
},

@@ -18,32 +28,29 @@ "repository": {

"readmeFilename": "README.md",
"dependencies": {
"shred": "0.8.10",
"btoa": "1.1.1",
"swagger-client": "2.1.4-M1"
},
"devDependencies": {
"chai": "^1.10.0",
"cors": "2.1.1",
"docco": "0.4.x",
"event-stream": "^3.2.1",
"express": "3.x",
"gulp": "^3.8.10",
"chai": "^2.1.0",
"cors": "^2.5.3",
"docco": "^0.7.0",
"event-stream": "^3.2.2",
"express": "^4.12.0",
"gulp": "^3.8.11",
"gulp-clean": "^0.3.1",
"gulp-coffee": "^2.2.0",
"gulp-concat": "^2.4.3",
"gulp-concat": "^2.5.2",
"gulp-connect": "^2.2.0",
"gulp-declare": "^0.3.0",
"gulp-handlebars": "^3.0.1",
"gulp-header": "1.2.2",
"gulp-less": "^2.0.1",
"gulp-header": "^1.2.2",
"gulp-jshint": "^1.10.0",
"gulp-less": "^3.0.1",
"gulp-order": "^1.1.1",
"gulp-rename": "^1.2.0",
"gulp-uglify": "^1.1.0",
"gulp-util": "^3.0.2",
"gulp-watch": "^4.1.0",
"gulp-wrap": "^0.10.1",
"http-server": "^0.7.4",
"less": "~1.4.2",
"gulp-watch": "^4.1.1",
"gulp-wrap": "^0.11.0",
"http-server": "git+https://github.com/nodeapps/http-server.git",
"jshint-stylish": "^1.0.1",
"less": "^2.4.0",
"mocha": "^2.1.0",
"selenium-webdriver": "^2.44.0"
"selenium-webdriver": "^2.45.0",
"swagger-client": "2.1.5-M2"
}
}

@@ -0,1 +1,4 @@

'use strict';
$(function() {

@@ -6,7 +9,7 @@

$.fn.vAlign = function() {
return this.each(function(i){
var ah = $(this).height();
var ph = $(this).parent().height();
var mh = (ph - ah) / 2;
$(this).css('margin-top', mh);
return this.each(function(){
var ah = $(this).height();
var ph = $(this).parent().height();
var mh = (ph - ah) / 2;
$(this).css('margin-top', mh);
});

@@ -16,7 +19,7 @@ };

$.fn.stretchFormtasticInputWidthToParent = function() {
return this.each(function(i){
var p_width = $(this).closest("form").innerWidth();
var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest("form").css('padding-right'), 10);
var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
$(this).css('width', p_width - p_padding - this_padding);
return this.each(function(){
var p_width = $(this).closest("form").innerWidth();
var p_padding = parseInt($(this).closest("form").css('padding-left') ,10) + parseInt($(this).closest('form').css('padding-right'), 10);
var this_padding = parseInt($(this).css('padding-left'), 10) + parseInt($(this).css('padding-right'), 10);
$(this).css('width', p_width - p_padding - this_padding);
});

@@ -43,3 +46,3 @@ };

// Tack the error style on if the input is empty..
if ($(this).val() == '') {
if ($(this).val() === '') {
$(this).addClass('error');

@@ -57,3 +60,3 @@ $(this).wiggle();

function clippyCopiedCallback(a) {
function clippyCopiedCallback() {
$('#api_key_copied').fadeIn().delay(1000).fadeOut();

@@ -69,3 +72,3 @@

// Logging function that accounts for browsers that don't have window.console
log = function(){
function log(){
log.history = log.history || [];

@@ -76,6 +79,6 @@ log.history.push(arguments);

}
};
}
// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
if (Function.prototype.bind && console && typeof console.log == "object") {
if (Function.prototype.bind && console && typeof console.log === "object") {
[

@@ -88,3 +91,3 @@ "log","info","warn","error","assert","dir","clear","profile","profileEnd"

var Docs = {
window.Docs = {

@@ -141,3 +144,3 @@ shebang: function() {

}
$('li#resource_' + resource).addClass('active');

@@ -166,3 +169,3 @@

Docs.expandEndpointListForResource(resource);
if (resource == '') {

@@ -169,0 +172,0 @@ $('.resource ul.endpoints li.operation div.content').slideDown();

@@ -0,16 +1,8 @@

'use strict';
var expect = require('chai').expect;
var driver = require('./driver');
var servers = require('./servers');
var webdriver = require('selenium-webdriver');
var createServer = require('http-server').createServer;
var expect = require('chai').expect;
var path = require('path')
var dist = path.join(__dirname, '..', '..', 'dist');
var specs = path.join(__dirname, '..', '..', 'test', 'specs');
var DOCS_PORT = 8080;
var SPEC_SERVER_PORT = 8081
var headers = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
};
var elements = [

@@ -26,17 +18,8 @@ 'swagger-ui-container',

describe('swagger 1.x spec tests', function (done) {
this.timeout(10 * 10000);
var swaggerUI, specServer, driver;
describe('swagger 1.x spec tests', function () {
this.timeout(10 * 1000);
before(function () {
swaggerUI = createServer({ root: dist, headers: headers });
specServer = createServer({ root: specs, headers: headers });
driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.firefox()).build();
swaggerUI.listen(DOCS_PORT);
specServer.listen(SPEC_SERVER_PORT);
var swaggerSpecLocation = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + '/v1.2/petstore/api-docs')
driver.get('http://localhost:' + DOCS_PORT + '/index.html?url=' + swaggerSpecLocation);
before(function (done) {
this.timeout(25 * 1000);
servers.start('/v1.2/petstore/api-docs.json', done);
});

@@ -50,4 +33,5 @@

// 900 and above is "error" level. Console should not have any errors
if (log.level.value > 900)
if (log.level.value > 900) {
console.log('browser error message:', log.message); errors.push(log);
}
});

@@ -70,3 +54,3 @@ expect(errors).to.be.empty;

it('should render element: ' + id, function (done) {
var locator = webdriver.By.id(id)
var locator = webdriver.By.id(id);
driver.isElementPresent(locator).then(function (isPresent) {

@@ -79,3 +63,4 @@ expect(isPresent).to.be.true;

it('should find the contact name element', function(done){
// TODO: enable me
xit('should find the contact name element', function(done){
var locator = webdriver.By.css('.info_name');

@@ -89,3 +74,3 @@ driver.isElementPresent(locator).then(function (isPresent) {

it('should find the pet link', function(done){
var locator = webdriver.By.xpath("//*[@data-id='pet']");
var locator = webdriver.By.xpath('//*[@data-id="pet"]');
driver.isElementPresent(locator).then(function (isPresent) {

@@ -97,4 +82,13 @@ expect(isPresent).to.be.true;

// TODO: enable me
xit('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']");
var locator = webdriver.By.xpath('//*[@data-id="user"]');
driver.isElementPresent(locator).then(function (isPresent) {

@@ -107,3 +101,3 @@ expect(isPresent).to.be.true;

it('should find the store link', function(done){
var locator = webdriver.By.xpath("//*[@data-id='store']");
var locator = webdriver.By.xpath('//*[@data-id="store"]');
driver.isElementPresent(locator).then(function (isPresent) {

@@ -115,7 +109,5 @@ expect(isPresent).to.be.true;

after(function() {
swaggerUI.close();
specServer.close();
driver.quit();
after(function(){
servers.close();
});
});

@@ -0,16 +1,9 @@

'use strict';
var expect = require('chai').expect;
var webdriver = require('selenium-webdriver');
var createServer = require('http-server').createServer;
var expect = require('chai').expect;
var path = require('path')
var driver = require('./driver');
var servers = require('./servers');
var dist = path.join(__dirname, '..', '..', 'dist');
var specs = path.join(__dirname, '..', '..', 'test', 'specs');
var DOCS_PORT = 8080;
var SPEC_SERVER_PORT = 8081
var headers = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept'
};
var elements = [

@@ -26,17 +19,8 @@ 'swagger-ui-container',

describe('swagger 2.0 spec tests', function (done) {
describe('swagger 2.0 spec tests', function () {
this.timeout(10 * 1000);
var swaggerUI, specServer, driver;
before(function () {
swaggerUI = createServer({ root: dist, headers: headers });
specServer = createServer({ root: specs, headers: headers });
driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.firefox()).build();
swaggerUI.listen(DOCS_PORT);
specServer.listen(SPEC_SERVER_PORT);
var swaggerSpecLocation = encodeURIComponent('http://localhost:' + SPEC_SERVER_PORT + '/v2/petstore.json')
driver.get('http://localhost:' + DOCS_PORT + '/index.html?url=' + swaggerSpecLocation);
before(function (done) {
this.timeout(25 * 1000);
servers.start('/v2/petstore.json', done);
});

@@ -50,4 +34,5 @@

// 900 and above is "error" level. Console should not have any errors
if (log.level.value > 900)
if (log.level.value > 900) {
console.log('browser error message:', log.message); errors.push(log);
}
});

@@ -103,3 +88,3 @@ expect(errors).to.be.empty;

it('should find the pet link', function(done){
var locator = webdriver.By.xpath("//*[@data-id='pet']");
var locator = webdriver.By.xpath('//*[@data-id="pet"]');
driver.isElementPresent(locator).then(function (isPresent) {

@@ -111,4 +96,12 @@ expect(isPresent).to.be.true;

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']");
var locator = webdriver.By.xpath('//*[@data-id="user"]');
driver.isElementPresent(locator).then(function (isPresent) {

@@ -121,3 +114,3 @@ expect(isPresent).to.be.true;

it('should find the store link', function(done){
var locator = webdriver.By.xpath("//*[@data-id='store']");
var locator = webdriver.By.xpath('//*[@data-id="store"]');
driver.isElementPresent(locator).then(function (isPresent) {

@@ -130,6 +123,4 @@ expect(isPresent).to.be.true;

after(function() {
swaggerUI.close();
specServer.close();
driver.quit();
servers.close();
});
});
{
"swagger": "2.0",
"info": {
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.wordnik.com\">http://swagger.wordnik.com</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
"version": "1.0.0",

@@ -11,3 +11,3 @@ "title": "Swagger Petstore",

"name": "Your pals at Swagger",
"email": "apiteam@wordnik.com"
"email": "apiteam@swagger.io"
},

@@ -19,3 +19,3 @@ "license": {

},
"host": "petstore.swagger.wordnik.com",
"host": "petstore.swagger.io",
"basePath": "/v2",

@@ -25,2 +25,24 @@ "schemes": [

],
"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": {

@@ -578,3 +600,4 @@ "/pet": {

"required": false,
"type": "string"
"type": "string",
"format": "password"
}

@@ -727,3 +750,3 @@ ],

"type": "oauth2",
"authorizationUrl": "http://petstore.swagger.wordnik.com/api/oauth/dialog",
"authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog",
"flow": "implicit"

@@ -730,0 +753,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc