Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion fittings/swagger_raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swagger-node-runner",
"version": "0.7.3",
"version": "0.8.0",
"description": "Swagger loader and middleware utilities",
"keywords": [
"swagger",
Expand All @@ -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": {
Expand Down
25 changes: 14 additions & 11 deletions test/assets/project/api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ schemes:
- http
consumes:
- application/json
- text/plain
- multipart/form-data
- application/x-www-form-urlencoded
produces:
- application/json
paths:
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -365,7 +368,7 @@ paths:
default:
description: Error
schema:
$ref: "#/definitions/ErrorResponse"
$ref: "#/definitions/ErrorResponse"

definitions:
HelloWorldResponse:
Expand Down
7 changes: 4 additions & 3 deletions test/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
});
Expand Down