Skip to main content

Module validator

Module validator 

Source
Expand description

Running rules against input, and what comes back when they all pass.

The semantics follow Laravel closely, including the two that surprise people if they are not written down:

  • A field that was never sent only trips required. Every other rule is skipped, so nullable|integer on an absent field is silence, not an error.
  • A blank string — an untouched text input, which a browser submits as "" rather than omitting — is treated as absent for the same reason.

On success the validator hands back a Validated containing only the fields that had rules. That is the point of validating: what comes out is the subset that was actually checked, so an unexpected extra field in the body cannot ride along into a database write.

Structs§

Validated
The fields that had rules and passed them.
Validator
A set of fields, their rules, and the values to run them against.