Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Wires up
symfony/validator
so we can use it for robust and potentially complex validation logic.Usage is:
e.g. for testing if a URL is valid:
Most of the constraints in https://symfony.com/doc/current/reference/constraints.html are explicitly supported, except for the following:
Any which require
symfony/expression-language
:Symfony\Component\Validator\Constraints\Expression
Symfony\Component\Validator\Constraints\ExpressionSyntax
Symfony\Component\Validator\Constraints\When
Any which require
symfony/http-client
:Symfony\Component\Validator\Constraints\NotCompromisedPassword
Any which require
symfony/intl
:Symfony\Component\Validator\Constraints\Bic
Symfony\Component\Validator\Constraints\Country
Symfony\Component\Validator\Constraints\Currency
Symfony\Component\Validator\Constraints\Language
Symfony\Component\Validator\Constraints\Locale
Any which require
symfony/doctrine
or anything which assumes we're using symfony/validate in the context of setting constraints on metadata objects:Symfony\Component\Validator\Constraints\Cascade
Symfony\Component\Validator\Constraints\Traverse
Symfony\Component\Validator\Constraints\Valid
With exception of those last three (which I've mentioned in the docs are explicitly not supported, because it relies on extra wiring up of things that we just aren't gonna do), I'd expect the others to all work - I just haven't included tests for them because we don't have those dependencies.
Issues
Pull request checklist