Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Api] Laravel feature breaks Api Validated Request abstraction #167

Closed
aedart opened this issue Apr 20, 2023 · 0 comments
Closed

[Api] Laravel feature breaks Api Validated Request abstraction #167

aedart opened this issue Apr 20, 2023 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@aedart
Copy link
Owner

aedart commented Apr 20, 2023

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.

@aedart aedart added the bug Something isn't working label Apr 20, 2023
@aedart aedart added this to the v7.x milestone Apr 20, 2023
@aedart aedart self-assigned this Apr 20, 2023
@aedart aedart changed the title [Api] Laravel features breaks Api Validated Request abstraction [Api] Laravel feature breaks Api Validated Request abstraction Apr 20, 2023
aedart added a commit that referenced this issue Apr 20, 2023
@aedart aedart closed this as completed Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant