Enum validation rule
brendt opened this issue · 8 comments
Would it make sense to add one or more custom validation rules to validate request input?
It should extend the in:...
rule. So instead of doing in:draft,archived,published
it should be enum:StatusEnum::class
.
This goes the normal way: StatusEnum::make()
doing a try catch and return true/false. This wouldn't handle the legacy value map because this logic is present in the model not the enum. See my comments in #1 for the option that $map
could be dropped so this couldn't be an issue.
In favor of the normal in:...
rule this would allow to use the value, name or index without listing all possibilities.
Great idea with extending the in:
rule. Are you motivated to submit a PR for this? No pressure.
Yeah, will check it out.
Dear contributor,
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.
@Gummibeer Is there a time estimate when the feature will be released?
@dennisoderwald were you able to test it? dev-ft-rules
as composer version should do the trick.
If you could give feedback it would be awesome. Otherwise I will wait for feedback by @brendt .
Dear contributor,
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.