Finish implementing Validations
ryanwinchester opened this issue · 5 comments
Implement validations and test:
- acceptance (valid & invalid)
- cast (valid & invalid)
- change (valid & invalid)
- confirmation (valid & invalid)
- count:is (valid & invalid)
- count:min (valid & invalid)
- count:max (valid & invalid)
- exclusion (valid & invalid)
- format (valid & invalid)
- inclusion (valid & invalid)
- length:is (valid & invalid)
- length:min (valid & invalid)
- length:max (valid & invalid)
- number:less_than (valid & invalid)
- number:greater_than (valid & invalid)
- number:less_than_or_equal_to (valid & invalid)
- number:greater_than_or_equal_to (valid & invalid)
- number:equal_to (valid & invalid)
- required (valid & invalid)
- subset (valid & invalid)
Hi @ryanwinchester , I can help with that task
The Validations are stubbed here:
https://github.com/ryanwinchester/plasm/blob/master/src/Changeset/Validations.php
and the Tests are stubbed here:
https://github.com/ryanwinchester/plasm/blob/master/tests/ChangesetValidationsTest.php
For reference, the definitions of the functions that inspired the library are here:
https://hexdocs.pm/ecto/Ecto.Changeset.html#validate_acceptance/3
@ryanwinchester I have a small question regarding length
validation implementation. My plan is to use mb_strlen function to calculate length of the string.
Unfortunately, mbstring
is a non-default extension, to use mb_strlen function I need to add ext-mbstring: *
to require
section of composer.json file.
Are you ok with that?
@krlv yes, that is okay
All done! :)