Skip to content

Commit 683ec96

Browse files
committed
Merge pull request swagger-api#692 from whitlockjc/fix-678
Do not create operations for non-HTTP methods/verbs
2 parents 924e964 + 757794f commit 683ec96

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/swagger-client.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
9595
if (result === true)
9696
status = true;
9797
}
98-
}
98+
}
9999
}
100100
}
101101

@@ -415,6 +415,9 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
415415
if(typeof response.paths[path] === 'object') {
416416
var httpMethod;
417417
for(httpMethod in response.paths[path]) {
418+
if(['delete', 'get', 'head', 'options', 'patch', 'post', 'put'].indexOf(httpMethod) === -1) {
419+
continue;
420+
}
418421
var operation = response.paths[path][httpMethod];
419422
var tags = operation.tags;
420423
if(typeof tags === 'undefined') {
@@ -991,7 +994,7 @@ Operation.prototype.encodeCollection = function(type, name, value) {
991994
}
992995

993996
/**
994-
* TODO this encoding needs to be changed
997+
* TODO this encoding needs to be changed
995998
**/
996999
Operation.prototype.encodeQueryParam = function(arg) {
9971000
return escape(arg);
@@ -1031,7 +1034,7 @@ var Model = function(name, definition) {
10311034
if(requiredFields.indexOf(key) >= 0)
10321035
required = true;
10331036
this.properties.push(new Property(key, property, required));
1034-
}
1037+
}
10351038
}
10361039
}
10371040

@@ -1210,7 +1213,7 @@ Property.prototype.toString = function() {
12101213
str += ', <span class="propOptKey">optional</span>';
12111214
str += ')';
12121215
}
1213-
else
1216+
else
12141217
str = this.name + ' (' + JSON.stringify(this.obj) + ')';
12151218

12161219
if(typeof this.description !== 'undefined')
@@ -1474,4 +1477,4 @@ ShredHttpClient.prototype.execute = function(obj) {
14741477
obj.on = res;
14751478
}
14761479
return this.shred.request(obj);
1477-
};
1480+
};

0 commit comments

Comments
 (0)