[Api] Laravel feature breaks Api Validated Request abstraction
aedart opened this issue · 0 comments
Description
The Class based after validation rules feature that was introduced in Laravel v10.8.0
breaks the ApiValidatedRequest
abstraction, because it automatically invokes the after()
method and expects it to return an array of additional validation rules. This break was reported, but sadly rejected. Now, consumers of the validation abstraction have their applications broken.
Possible solution
To avoid introducing a breaking chance in Athenaeum, Laravel's new feature must, sadly, be force disabled. This should be doable by overwriting the getValidatorInstance()
(defined in FormRequest
) and comment out the if (method_exists($this, 'after')) ...
statement.
However, this is only a short term solution. The after()
that is defined in ApiValidatedRequest
must now be deprecated and a replacement method name must be introduced, such that the same behaviour can be kept. In the next major version, the after()
method can be safely removed, documented in the migration plan and the "fix" code can be removed entirely, which will also re-enable Laravel's feature.