-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Context
- node version: 10.16.2
- joi version: 16.1.1
- environment (node, browser): node
- used with (hapi, standalone, ...): standalone
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
const schema = Joi.object({
foo: Joi.string().default('bar')
}).default({
foo: 'bar'
});
schema.describe(); // throws ValidationErrorWhich result you had ?
ValidationError: {
"type": "object",
"flags": {
"default" [1]: {
"foo": "bar"
}
},
"keys": {
"foo": {
"type": "string",
"flags": {
"default": "bar"
}
}
}
}
[1] "flags.default" does not match any of the allowed types
What did you expect ?
Proper output of schema.describe(). It's my understanding that objects can be passed to default() and the provided default on the overall schema matches the described schema. I'm confused as to why this would fail.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect