They only know what message a rule produces when they try running it.
Including the messages in the documentation will make it easier for
people to know what to expect.
There are a couple of undocumented placeholders, but I can live with
that for now.
The method has been renamed some time ago, but I haven't updated the
documentation to cause less confusion. Now that I want to start updating
the documentation, I switched the default branch on GitHub to the latest
stable version, so I assume there will be less confusion in the
documentation, and I can start updating the docs for the next version.
After changes in the key-related rules, the KeySet rule became unusable.
Besides, when evaluating an input, it wasn't reporting every single
failure because it would not validate the items in the array if they had
missing or extra keys.
This commit will make several improvements to the rule. It will create
some not(keyExists($key)) rules for the extra keys, which makes the
error reporting much better. A limit of 10 additional keys will show up
when asserting an input with extra keys. I put that limit in place to
prevent the creation of too many rules.
This change will also make the composite-based rules require at least
two rules in their constructor because those rules do not make sense
with only one rule.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
I want to avoid having the Factory inside the rules. If a rule needs to
create another, it can simply instantiate that. The "KeyValue" rule does
too many things under the hood, and the behavior can be unpredictable.
The "LazyConsecutive" rule makes the validation more explicit and way
more flexible, as there could be other cases in which someone only wants
to validate something if the previous validator passes.
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
The use case for negating a keyset is very confusing, and can
lead to validators that don't do what they expect.
This commit introduces NonNegatable rules, which will throw
a Component exception if you try to wrap them in `Not`.
This change was necessary to ensure proper message reporting
when extra keys exist on the keyset.
This fixes#1349
The current documentation is hosted via GitHub pages rendered by
"Couscous". Every time we need a new version of the documentation
published we need to manually execute the "couscous".
This commit reorganize the documentation to be published to
"Read the Docs" because it will also allow us to have documentations per
version of the library most importantly provider a search field for the
documentation.
The documentation will be then published on:
https://respect-validation.readthedocs.io/
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>