joi
joi copied to clipboard
Make SchemaMap warn if missing keys
Support plan
- is this issue currently blocking your project? (yes/no): no
- is this issue affecting a production system? (yes/no): no
Context
- node version: v14.15.1
- module version: 17.1.1
- environment (e.g. node, browser, native): node
- used with (e.g. hapi application, another framework, standalone, ...): nestjs
- any other relevant information:
How can we help?
I'd like to know if there is a way to indicate with Joi that a validation schema is missing certain keys. The easiest way I can think of is through an example:
interface Config {
readonly FOO: string
readonly BAR: string
}
// This should not compile, saying that the object passed in is missing property BAR
export const configValidationSchema = Joi.object<Config>({
FOO: Joi.string().required()
});
Apologies if this is a trivial question, still finding my bearings.