Required vs Present rule by default #108
-
With the current implementation a DataCollection will get the 'required' rule added by default. However, this rule disallows for empty values: https://laravel.com/docs/8.x/validation#rule-required . So sending an empty array to a data class property of type DataCollection will not validate. Is this by design? Of would the 'present' rule be a better option by default https://laravel.com/docs/8.x/validation#rule-present ? I also can't seem to use a Rule Attribute when using Data/DataCollection, as the RuleInferrerers only get run when the property is not Data and not DataCollection... Is this correct? Could this be changed? Using the rules() function does work but I would prefer an Attribute |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@iamrgroot fixed this in v1.4.4. What validation attributes would you add to a data property? |
Beta Was this translation helpful? Give feedback.
@iamrgroot fixed this in v1.4.4.
What validation attributes would you add to a data property?