Is possible that the s3Object only will be required when s3Object key exists?
const schema = {
name: {
type: String,
required: true
},
s3Object: {
name: {
type: String
},
data: {
type: String
}
}
}
The following example pass validation, but I need that fails because s3Object is defined
but it doesn't have the name and data properties:
const obj = {
name: "test",
s3Object: {
}
}
Only can pass the validation the next examples:
const obj1 = {
name: "test"
}
const obj2 = {
name: "test",
s3Object: {
name: "test",
data: "dopafawe"
}
}
Thanks!
Is possible that the s3Object only will be required when s3Object key exists?
The following example pass validation, but I need that fails because s3Object is defined
but it doesn't have the name and data properties:
Only can pass the validation the next examples:
Thanks!