I've been trying to implement Joi in our node application (joi as standalone, not with hapi) and it seems to validate the schema properly but the error is always the same
[ValidationError: value must be an object]
name: 'ValidationError',
details:
[ { message: 'value must be an object',
path: 'value',
type: 'object.base',
context: [Object] } ],
_object:.....
I never get the specifics on which key it failed on and description of why it failed.
this is a sample schema I'm using:
exports.workersSchema =
{
workers: joi.array({
id: joi.string().alphanum(),
wID: joi.object({
idValue: joi.string().alphanum()
}),
person: {
governmentIDs: joi.array({itemID: joi.string().alphanum()}),
legalName: joi.object({
givenName: joi.string(),
middleName: joi.string(),
preferredSalutations: joi.array(
{
salutationCode: {
longName: joi.string()
}
}
),
preferredName: joi.object().keys({
FormattedName: joi.string()
}),
}),
birthDate: joi.string().alphanum()
}
})
}
What am i doing wrong here? I even tried to follow something on the blog and while the examples were showing detailed info I never got anything besides
"value must be an object"
Thank you so much for the help!
Aucun commentaire:
Enregistrer un commentaire