I'm able to perform Joi Validations for function expressions in node as shown below
export var shippingInfo = Joi.object().keys({
expectedDeliveryDate:Joi.date().required(),
isRegisteredCompanyAddress:Joi.number().required(),
addressLine:Joi.string(),
country:Joi.string(),
state:Joi.string(),
city:Joi.string(),
zipcode:Joi.string()
});
But the problem is, I recently started working on typescript. So here, I've few classes and I'm supposed to perform the Joi validations as I did in the above function expressions. i.e I want to validate for the below class
export class ShippingInfo {
expectedDeliveryDate: Date,
isRegisteredCompanyAddress: number,
addressLine:string,
country:string,
state:string,
city:string,
zipcode:string
}
How should I make validations for the above class. Should do validations for class level or it's object level? how?