Skip to content
Discussion options

You must be logged in to vote

Validation attributes attached to an array property target the property path itself (messagesId), not its wildcard element path (messagesId.*). There is currently no property-attribute syntax that redirects IntegerType, Distinct, or Exists to every scalar item.

The intended solution is to keep collection-level constraints as attributes and define element constraints in rules():

use Spatie\LaravelData\Attributes\Validation\ArrayType;
use Spatie\LaravelData\Attributes\Validation\Distinct;
use Spatie\LaravelData\Attributes\Validation\Exists;
use Spatie\LaravelData\Attributes\Validation\IntegerType;
use Spatie\LaravelData\Attributes\Validation\Max;
use Spatie\LaravelData\Attributes\Validation\S…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by deniskorbakov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants