Hv
Hash validation. At the moment the validation only return true or false when it match the schema.
Installation
Add this line to your application's Gemfile:
gem 'hv'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hv
Usage
person_schema = { name: {type?: String} }
schema = {
people: {
array?: person_schema
}
}
schema = Schema.new(schema)
schema.validates?({people: [{name: "juan"}, {name: "chus"}]}) # => true
Check 'test' folder for more validators examples.
TODO
- Improve documentation
- return errors
- sanitize input
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Hv project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.