lighthouse
lighthouse copied to clipboard
Custom validation attributes
What problem does this feature proposal attempt to solve?
Looking the validation docs, I found a function: "Validation custom attributes".
The function can replace the ":attribute" in the errors messages, but I saw validation directive have a three rare custom validation. https://github.com/nuwave/lighthouse/blob/4.x/src/Schema/Directives/ValidationDirective.php#L46
Why? @spawnia
Which possible solutions should be considered?
- Remove the three rare custom validation (because the custom attributes if only to rename attributes name)
- Add a function attributes and return a array (like messages)
- In the make function of ValidationFactory, assign the values returned from the new attributes function
- Check if the code has same code copied (like FieldFactory)
https://laravel.com/docs/6.x/validation#customizing-the-validation-attributes
Validation has been completely revamped, you can check out the latest master and see how your desired change might fit in there. Open for PR's.