Commit graph

12 commits

Author SHA1 Message Date
Henrique Moody
bba39a4bfb
Add headings to the templates 2024-12-09 01:34:50 +01:00
Henrique Moody
be72a54845
Add templates to each rule documentation
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.
2024-12-06 00:21:47 +01:00
Henrique Moody
061a3c9c09
Rename method "validate()" to "isValid()"
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.
2024-12-02 22:11:57 +01:00
Henrique Moody
2aa5e39c54
Improve KeySet rule
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.
2024-12-02 20:09:47 +01:00
Henrique Moody
c04034c2a4
Update the validation engine of composite-based 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>
2024-02-23 00:56:30 +01:00
Henrique Moody
41245f663f
Replace "KeyValue" with "LazyConsecutive" rule
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>
2024-02-22 20:45:50 +01:00
Alexandre Gomes Gaigalas
fc8230acef Make KeySet impossible to wrap in not(), fix structure message
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
2023-02-19 00:19:10 -03:00
Henrique Moody
10df3211f5
Add "Categorization" section to rule documentations
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2019-05-11 19:16:21 +02:00
Henrique Moody
a00617bcad
Merge branch '1.1' 2018-12-11 13:31:50 +01:00
Henrique Moody
a009286ba6
Update "See also" section in the rules's documentation
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-12-11 13:19:52 +01:00
Henrique Moody
4354652195
Merge branch '1.1' 2018-08-23 02:12:44 +02:00
Henrique Moody
52614d600d
Organize documentation for "Read the Docs"
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>
2018-08-23 01:59:39 +02:00
Renamed from docs/KeySet.md (Browse further)