Conversation
|
I think for root behavior it makes the most sense to just leave the object alone.. If my schema looks like |
|
@Marsup what do you think about allowing to pass an array of keys to be removed from an object as well? something like Joi.object({
id: Joi.string(),
password: Joi.string(),
private: Joi.string()
}).strip(['password', 'private'])This would be useful in Joi.object({
id: Joi.string(),
password: Joi.string(),
private: Joi.string()
}).when('some condition', { is: true, then: Joi.strip(['password, 'private']) }); |
|
Why should the behavior be different just because it's root ? It seems inconsistent. |
|
Yeah, it does seem weird, it was a thought that would make stripping multiple keys under the same condition possible without having to repeat the condition. I started trying to implement that behavior though, and it becomes problematic quickly so I think it's probably not worth it. |
502280c to
7a9e5d4
Compare
add any.strip for objects and arrays
|
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
This is ready