diff --git a/README.md b/README.md index 937863b..968f4c6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Middleware for Swagger projects -[![Build Status](https://travis-ci.org/theganyo/swagger-node-runner.svg?branch=master)](https://travis-ci.org/swagger-api/swagger-node-runner) +[![Build Status](https://travis-ci.org/apigee-127/swagger-node-runner.svg?branch=master)](https://travis-ci.org/apigee-127/swagger-node-runner) [![Coverage Status](https://coveralls.io/repos/theganyo/swagger-node-runner/badge.svg?branch=sway&service=github)](https://coveralls.io/github/theganyo/swagger-node-runner) diff --git a/fittings/swagger_raw.js b/fittings/swagger_raw.js index 80640f4..83527da 100644 --- a/fittings/swagger_raw.js +++ b/fittings/swagger_raw.js @@ -47,7 +47,7 @@ module.exports = function create(fittingDef, bagpipes) { function filterKeysRecursive(object, dropTagRegex, privateTags) { if (_.isPlainObject(object)) { - if (_.any(privateTags, function(tag) { return object[tag]; })) { + if (_.some(privateTags, function(tag) { return object[tag]; })) { object = undefined; } else { var result = {}; diff --git a/package.json b/package.json index 63048b6..12223fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "swagger-node-runner", - "version": "0.7.3", + "version": "0.8.0", "description": "Swagger loader and middleware utilities", "keywords": [ "swagger", @@ -27,11 +27,11 @@ "cors": "^2.5.3", "debug": "^2.1.3", "js-yaml": "^3.3.0", - "lodash": "^3.6.0", + "lodash": "^4.17.11", "multer": "^1.0.6", "parseurl": "^1.3.0", "qs": "^6.4.0", - "sway": "^1.0.0", + "sway": "^2.0.5", "type-is": "^1.6.9" }, "devDependencies": { diff --git a/test/assets/project/api/swagger/swagger.yaml b/test/assets/project/api/swagger/swagger.yaml index 377651b..c4ddb78 100644 --- a/test/assets/project/api/swagger/swagger.yaml +++ b/test/assets/project/api/swagger/swagger.yaml @@ -8,6 +8,9 @@ schemes: - http consumes: - application/json + - text/plain + - multipart/form-data + - application/x-www-form-urlencoded produces: - application/json paths: @@ -321,8 +324,8 @@ paths: get: description: well, what do you know... operationId: pipeInterface - responses: - 200: + responses: + 200: description: Whatever schema: {} /controller_interface_auto_detected_as_middleware: @@ -331,27 +334,27 @@ paths: get: description: well, what do you know... operationId: middlewareInterface - responses: - 200: + responses: + 200: description: Whatever schema: {} /controller_interface_on_path_cascades: x-swagger-router-controller: overrides_ctrl_interface_pipe x-controller-interface: pipe - get: + get: operationId: pipeInterface - responses: - 200: + responses: + 200: description: Whatever schema: {} /controller_interface_on_operation_cascades: x-swagger-router-controller: overrides_ctrl_interface_pipe x-controller-interface: pipe - get: + get: x-controller-interface: middleware operationId: middlewareInterface - responses: - 200: + responses: + 200: description: Whatever schema: {} /controller_interface_pipe_operation_with_no_body: @@ -365,7 +368,7 @@ paths: default: description: Error schema: - $ref: "#/definitions/ErrorResponse" + $ref: "#/definitions/ErrorResponse" definitions: HelloWorldResponse: diff --git a/test/lib/common.js b/test/lib/common.js index 76ee74a..5e64ae6 100644 --- a/test/lib/common.js +++ b/test/lib/common.js @@ -204,8 +204,9 @@ module.exports = function() { it('should reject when invalid content', function(done) { request(this.app) - .put('/expect_integer') - .set('Content-Type', 'text/plain') + .get('/hello_body') + .send('name=Scott') + .set('Content-Type', 'yolo/swag') .expect(400) .expect('Content-Type', /json/) .end(function(err, res) { @@ -214,7 +215,7 @@ module.exports = function() { res.body.errors.should.be.an.Array; res.body.errors[0].should.have.properties({ code: 'INVALID_CONTENT_TYPE', - message: 'Invalid Content-Type (text/plain). These are supported: application/json' + message: 'Invalid Content-Type (yolo/swag). These are supported: application/json, text/plain, multipart/form-data, application/x-www-form-urlencoded' }); done(); });