added required support for queries

Opened PR for feedback
I'll leave it as it is, because a major refactoring of how `Validator` generates errors will be done. Probably each validation method will be extracted into a class and some common processes extracted into helper methods.