[BUG] Nested document validation is broken
See original GitHub issueNested document validation seems to be broken in master branch. After a bit of debugging it seems that this is due to the fact that self.document attribute of subdocument validators gets assigned with a copy of the contents of the parent document (context
) causing further validation steps to fail.
To reproduce
import cerberus
schema = {
'info': {
'type': 'dict',
'schema': {
'name': {'type': 'string', 'required': True}
}
}
}
validator = cerberus.Validator(schema)
res = validator.validate({'info': {'name': 'my name'}})
if not res:
print validator._errors
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (10 by maintainers)
Top Results From Across the Web
Mongoose nested schema validation not working
This will give a validation error on the first document: ValidationError: Path `quantity` is required. Share.
Read more >Built-In, Nested, Custom Validators with FluentValidation
This very handy validator covers all the various email formats and edge cases so that we don't need to. Enum Validation. Most .NET...
Read more >Refactoring-safe nested validation with express-validator and ...
This is not type and refactoring safe, hence error prone. ... Finds the validation errors in this request and wraps them in an...
Read more >validate.js
Otherwise an object in this format is returned: {<attribute>: [<error>, <error>, ... Validate.js also has limited support for nested objects (objects within ...
Read more >Error Explanations for The W3C Markup Validation Service
This error may appear when the validator receives an empty document. Please make sure that the document you are uploading is not empty,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hm, this doesn’t fail.
what’s actually the output of your code above?
that’s a nasty one, see #111 for some progress.