Skip to content

Commit 9a02ae5

Browse files
committed
rebuilt
1 parent b192329 commit 9a02ae5

File tree

7 files changed

+60
-55
lines changed

7 files changed

+60
-55
lines changed

browser/swagger-client.js

Lines changed: 18 additions & 16 deletions
Large diffs are not rendered by default.

browser/swagger-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/resolver.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Resolver.prototype.processAllOf = function(name, definition, resolutionTable, un
2828
location = '/definitions/' + name + '/allOf';
2929
this.resolveInline(null, spec, property, resolutionTable, unresolvedRefs, location);
3030
}
31-
}
31+
};
3232

3333
Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) {
3434
var root = arg1, callback = arg2, scope = arg3, location, i;
@@ -115,6 +115,7 @@ Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) {
115115
// if the root is same as obj[i].root we can resolve locally
116116
var all = resolutionTable;
117117

118+
var parts;
118119
for(i = 0; i < all.length; i++) {
119120
var a = all[i];
120121
if(root === a.root) {
@@ -145,7 +146,7 @@ Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) {
145146
toResolve.push(a);
146147
}
147148
else {
148-
var parts = a.key.split('#');
149+
parts = a.key.split('#');
149150
if(parts.length === 2) {
150151
if(parts[0].indexOf('http://') === 0 || parts[0].indexOf('https://') === 0) {
151152
a.root = parts[0];
@@ -175,11 +176,11 @@ Resolver.prototype.resolve = function (spec, arg1, arg2, arg3) {
175176
}
176177
else {
177178
if (a.resolveAs === 'inline') {
178-
if(a.key && a.key.indexOf('#') == -1 && a.key.charAt(0) !== '/') {
179+
if(a.key && a.key.indexOf('#') === -1 && a.key.charAt(0) !== '/') {
179180
// handle relative schema
180-
var parts = a.root.split('/');
181-
var location = '';
182-
for(var i = 0; i < parts.length - 1; i++) {
181+
parts = a.root.split('/');
182+
location = '';
183+
for(i = 0; i < parts.length - 1; i++) {
183184
location += parts[i] + '/';
184185
}
185186
location += a.key;

lib/schema-markup.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports.schemaToJSON = schemaToJSON;
2323

2424
function optionHtml(label, value) {
2525
return '<tr><td class="optionName">' + label + ':</td><td>' + value + '</td></tr>';
26-
};
26+
}
2727

2828
function typeFromJsonSchema(type, format) {
2929
var str;
@@ -182,7 +182,7 @@ function schemaToJSON(schema, models, modelsToIgnore, modelPropertyMacro) {
182182
}
183183

184184
return output;
185-
};
185+
}
186186

187187
function schemaToHTML(name, schema, models, modelPropertyMacro) {
188188

@@ -229,7 +229,7 @@ function schemaToHTML(name, schema, models, modelPropertyMacro) {
229229
if(typeof modelPropertyMacro !== 'function') {
230230
modelPropertyMacro = function(prop){
231231
return (prop || {}).default;
232-
}
232+
};
233233
}
234234

235235
var references = {};
@@ -279,7 +279,7 @@ function schemaToHTML(name, schema, models, modelPropertyMacro) {
279279
}
280280

281281
return modelName;
282-
};
282+
}
283283

284284
function primitiveToHTML(schema) {
285285
var html = '<span class="propType">';
@@ -321,7 +321,8 @@ function schemaToHTML(name, schema, models, modelPropertyMacro) {
321321
html += '</span>';
322322

323323
return html;
324-
};
324+
}
325+
325326
function primitiveToOptionsHTML(schema, html) {
326327
var options = '';
327328
var type = schema.type || 'object';
@@ -415,7 +416,8 @@ function schemaToHTML(name, schema, models, modelPropertyMacro) {
415416
}
416417

417418
return html;
418-
};
419+
}
420+
419421
function processModel(schema, name) {
420422
var type = schema.type || 'object';
421423
var isArray = schema.type === 'array';
@@ -520,6 +522,5 @@ function schemaToHTML(name, schema, models, modelPropertyMacro) {
520522
}
521523

522524
return html + strongOpen + (isArray ? ']' : '}') + strongClose;
523-
};
524-
525-
};
525+
}
526+
}

test/auth.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('2.0 authorizations', function () {
138138
});
139139

140140
it('does not apply api-key headers when the value has been manually added', function () {
141-
var params = { api_key: 'foo' };
141+
var params = { 'api_key': 'foo' };
142142

143143
var parameters = [
144144
{
@@ -148,11 +148,11 @@ describe('2.0 authorizations', function () {
148148
}
149149
];
150150
var authorizations = new auth.SwaggerAuthorizations();
151-
authorizations.add("Basic", new auth.ApiKeyAuthorization('api_key', 'bar', 'header'));
151+
authorizations.add('Basic', new auth.ApiKeyAuthorization('api_key', 'bar', 'header'));
152152
var op = new Operation({}, 'http', 'test', 'get', '/path', { parameters: parameters },
153153
{}, {}, authorizations);
154154
var req = op.execute(params, {mock : true});
155-
expect(req.headers.api_key).to.equal('foo');
155+
expect(req.headers['api_key']).to.equal('foo');
156156
});
157157

158158
it('does not apply password auth when the value has been manually added', function () {
@@ -166,7 +166,7 @@ describe('2.0 authorizations', function () {
166166
}
167167
];
168168
var authorizations = new auth.SwaggerAuthorizations();
169-
authorizations.add("Basic", new auth.PasswordAuthorization('bar', 'baz'));
169+
authorizations.add('Basic', new auth.PasswordAuthorization('bar', 'baz'));
170170
var op = new Operation({}, 'http', 'test', 'get', '/path', { parameters: parameters },
171171
{}, {}, authorizations);
172172
var req = op.execute(params, {mock : true});

0 commit comments

Comments
 (0)