Do not create operations for non-HTTP methods/verbs

Fixes #678
This commit is contained in:
Jeremy Whitlock
2014-10-27 19:36:02 -06:00
parent cdd02ad8a3
commit 295fa75dc4

View File

@@ -95,7 +95,7 @@ SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
if (result === true) if (result === true)
status = true; status = true;
} }
} }
} }
} }
@@ -415,6 +415,9 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
if(typeof response.paths[path] === 'object') { if(typeof response.paths[path] === 'object') {
var httpMethod; var httpMethod;
for(httpMethod in response.paths[path]) { for(httpMethod in response.paths[path]) {
if(['delete', 'get', 'head', 'options', 'patch', 'post', 'put'].indexOf(httpMethod) === -1) {
continue;
}
var operation = response.paths[path][httpMethod]; var operation = response.paths[path][httpMethod];
var tags = operation.tags; var tags = operation.tags;
if(typeof tags === 'undefined') { if(typeof tags === 'undefined') {
@@ -991,7 +994,7 @@ Operation.prototype.encodeCollection = function(type, name, value) {
} }
/** /**
* TODO this encoding needs to be changed * TODO this encoding needs to be changed
**/ **/
Operation.prototype.encodeQueryParam = function(arg) { Operation.prototype.encodeQueryParam = function(arg) {
return escape(arg); return escape(arg);
@@ -1031,7 +1034,7 @@ var Model = function(name, definition) {
if(requiredFields.indexOf(key) >= 0) if(requiredFields.indexOf(key) >= 0)
required = true; required = true;
this.properties.push(new Property(key, property, required)); this.properties.push(new Property(key, property, required));
} }
} }
} }
@@ -1210,7 +1213,7 @@ Property.prototype.toString = function() {
str += ', <span class="propOptKey">optional</span>'; str += ', <span class="propOptKey">optional</span>';
str += ')'; str += ')';
} }
else else
str = this.name + ' (' + JSON.stringify(this.obj) + ')'; str = this.name + ' (' + JSON.stringify(this.obj) + ')';
if(typeof this.description !== 'undefined') if(typeof this.description !== 'undefined')
@@ -1474,4 +1477,4 @@ ShredHttpClient.prototype.execute = function(obj) {
obj.on = res; obj.on = res;
} }
return this.shred.request(obj); return this.shred.request(obj);
}; };