Custom Validation Rule conflicts with RequiredRuleInferrer
#53
-
I have the following custom validation rule which uses the new use Attribute;
use Illuminate\Validation\Rules\Enum as EnumRule;
use Spatie\LaravelData\Attributes\Validation\ValidationAttribute;
#[Attribute(Attribute::TARGET_PROPERTY)]
class Enum extends ValidationAttribute
{
public function __construct(
private string $enumClass
) {
}
public function getRules(): array
{
return [new EnumRule($this->enumClass)];
}
} In the When the laravel-data/src/RuleInferrers/RequiredRuleInferrer.php Lines 30 to 32 in eeabbc5 It throws the ff:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @juliomotol-hdmd, This issue should be fixed with v1.2.5, we've also added a Enum validation attribute by default! |
Beta Was this translation helpful? Give feedback.
Hi @juliomotol-hdmd,
This issue should be fixed with v1.2.5, we've also added a Enum validation attribute by default!