Skip to content

fix(laravel): keep the validation rules of a parameter - #8924

Open
Maxcastel wants to merge 1 commit into
api-platform:5.0from
Maxcastel:fix/laravel-parameter-user-constraints
Open

Maxcastel wants to merge 1 commit into
api-platform:5.0from
Maxcastel:fix/laravel-parameter-user-constraints

Conversation

@Maxcastel

@Maxcastel Maxcastel commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
Q A
Branch? 5.0
License MIT
Doc PR api-platform/docs#2381

On Laravel the rules generated from required/schema replaced the constraints of the parameter.

With QueryParameter(constraints: 'min:2', required: true) only required was checked, so ?isbn=a passed. The docs say the rules can be customized with constraints.

Same as Symfony now: when the parameter has constraints, they're used as is and nothing is generated (so required goes in the constraints too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant