Composite Schema. Error: "Cannot read property of undefined"
Open
bug
PR welcome
- Dominant language
- JavaScript
- Stars
- 511
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Validation nesting schemas throws an error if
Composite Schema
---
```
const user = schema({
email: String
});
const querySchema = schema({
user,
startDate: Date,
endDate: Date
});
```
Validation
---
```
await querySchema.validate({
startDate: (new Date())
});
```
the object I'm passing to `validate` method doesn't have key `user`. And since `user` not mandatory I expect validation to pass, but instead it throws `Error: Cannot read property 'email' of undefined`
Is it expecting behaviour?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.