Skip to content

Commit 6d2896b

Browse files
committed
Merge pull request hapijs#3121 from AdriVanHoudt/validate-array
allow array as valid validate config on headers, params, query and payload
2 parents 460afaf + 788cba7 commit 6d2896b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/schema.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ internals.routeBase = Joi.object({
116116
options: Joi.object(),
117117
ranges: Joi.boolean(),
118118
sample: Joi.number().min(0).max(100),
119-
schema: Joi.alternatives(Joi.object(), Joi.func()).allow(true, false),
120-
status: Joi.object().pattern(/\d\d\d/, Joi.alternatives(Joi.object(), Joi.func()).allow(true, false))
119+
schema: Joi.alternatives(Joi.object(), Joi.array(), Joi.func()).allow(true, false),
120+
status: Joi.object().pattern(/\d\d\d/, Joi.alternatives(Joi.object(), Joi.array(), Joi.func()).allow(true, false))
121121
})
122122
.without('modify', 'sample')
123123
.assert('options.stripUnknown', Joi.ref('modify'), 'meet requirement of having peer modify set to true'),
@@ -154,10 +154,10 @@ internals.routeBase = Joi.object({
154154
server: Joi.number().integer().positive().allow(false).required()
155155
}),
156156
validate: Joi.object({
157-
headers: Joi.alternatives(Joi.object(), Joi.func()).allow(null, false, true),
158-
params: Joi.alternatives(Joi.object(), Joi.func()).allow(null, false, true),
159-
query: Joi.alternatives(Joi.object(), Joi.func()).allow(null, false, true),
160-
payload: Joi.alternatives(Joi.object(), Joi.func()).allow(null, false, true),
157+
headers: Joi.alternatives(Joi.object(), Joi.array(), Joi.func()).allow(null, false, true),
158+
params: Joi.alternatives(Joi.object(), Joi.array(), Joi.func()).allow(null, false, true),
159+
query: Joi.alternatives(Joi.object(), Joi.array(), Joi.func()).allow(null, false, true),
160+
payload: Joi.alternatives(Joi.object(), Joi.array(), Joi.func()).allow(null, false, true),
161161
failAction: [
162162
Joi.string().valid('error', 'log', 'ignore'),
163163
Joi.func()

0 commit comments

Comments
 (0)