diff --git a/lib/swagger.js b/lib/swagger.js index 7108465d9..d2e63b99c 100644 --- a/lib/swagger.js +++ b/lib/swagger.js @@ -307,7 +307,7 @@ }; SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes, produces) { - var method, o, op, responseMessages, type, _i, _len, _results; + var method, o, op, ref, responseMessages, type, _i, _len, _results; if (ops) { _results = []; for (_i = 0, _len = ops.length; _i < _len; _i++) { @@ -325,6 +325,13 @@ produces = this.produces; } type = o.type || o.responseClass; + if (type === "array") { + ref = null; + if (o.items) { + ref = o.items["type"] || o.items["$ref"]; + } + type = "array[" + ref + "]"; + } responseMessages = o.responseMessages; method = o.method; if (o.httpMethod) { @@ -545,6 +552,7 @@ this.method = this.method.toLowerCase(); this.isGetMethod = this.method === "get"; this.resourceName = this.resource.name; + console.log("model type: " + type); if (((_ref = this.type) != null ? _ref.toLowerCase() : void 0) === 'void') { this.type = void 0; } diff --git a/src/swagger.coffee b/src/swagger.coffee index 50f0b2eab..58601fb86 100644 --- a/src/swagger.coffee +++ b/src/swagger.coffee @@ -258,6 +258,11 @@ class SwaggerResource produces = @produces type = o.type || o.responseClass + if(type is "array") + ref = null + if o.items + ref = o.items["type"] || o.items["$ref"] + type = "array[" + ref + "]" responseMessages = o.responseMessages method = o.method @@ -408,6 +413,7 @@ class SwaggerOperation @resourceName = @resource.name # if void clear it + console.log "model type: " + type if(@type?.toLowerCase() is 'void') then @type = undefined if @type? # set the signature of response class