Skip to content

Commit

Permalink
fix: allow array items in req body
Browse files Browse the repository at this point in the history
  • Loading branch information
theoomoregbee committed Apr 3, 2019
1 parent a5e58a6 commit b28dfb3
Show file tree
Hide file tree
Showing 5 changed files with 6,848 additions and 1,538 deletions.
6 changes: 5 additions & 1 deletion api/controllers/UserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ module.exports = {

list: function (req, res) {

}
},

roles: function (req, res) {

}
};

16 changes: 16 additions & 0 deletions config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ module.exports.routes = {
body: {}, //for post and put
query: [] //for get and others
}
},
'put /user/roles': {
controller: 'UserController',
action: 'roles',
swagger: {
summary: 'update user roles',
body: {
roles: {
type: 'array',
required: true,
items: {
type: 'string'
}
}
}
}
}

};
3 changes: 2 additions & 1 deletion lib/type-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ var validationsMap = {
maxLength: 'maxLength',
minLength: 'minLength',
regex: 'pattern',
enum: 'enum'
enum: 'enum',
items: 'items'
};

/**
Expand Down
Loading

0 comments on commit b28dfb3

Please sign in to comment.