-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
Context
- node version: v8.9.3
- joi version: 10.6.0
- environment : node
- used with : hapi
I am trying to validate a dynamic key that needs to be required:
validate: {
payload: Joi.object()
.pattern(/^id_[\s\S]*$/i, Joi.string().required())
.keys({
state: Joi.string().optional(),
presentation: Joi.string().optional(),
// etcI would expect -- or at least this is what I am trying to express -- that at least one key starting with id would be required. Unfortunately, whilst other forms of validation work alongside pattern (i.e. Joi.number()), required is ignored and therefore the validation will always pass even if a key with that pattern is missing from the payload.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement