From 4f65ef2d061215df348e3505856f0f41c7c909ed Mon Sep 17 00:00:00 2001 From: GeLoLabs <149005863+GeLoLabs@users.noreply.github.com> Date: Sat, 26 Oct 2024 09:16:49 +0200 Subject: [PATCH] fix(metadata): providing parameter constraints skips automatic ones (#6756) Co-authored-by: Eric GELOEN Co-authored-by: Antoine Bluchet --- .../ParameterValidationResourceMetadataCollectionFactory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Validator/Metadata/Resource/Factory/ParameterValidationResourceMetadataCollectionFactory.php b/src/Validator/Metadata/Resource/Factory/ParameterValidationResourceMetadataCollectionFactory.php index 1c16ed527e3..e34124f08ec 100644 --- a/src/Validator/Metadata/Resource/Factory/ParameterValidationResourceMetadataCollectionFactory.php +++ b/src/Validator/Metadata/Resource/Factory/ParameterValidationResourceMetadataCollectionFactory.php @@ -91,6 +91,10 @@ public function create(string $resourceClass): ResourceMetadataCollection private function addSchemaValidation(Parameter $parameter, ?array $schema = null, ?bool $required = null, ?OpenApiParameter $openApi = null): Parameter { + if (null !== $parameter->getConstraints()) { + return $parameter; + } + $schema ??= $parameter->getSchema(); $required ??= $parameter->getRequired() ?? false; $openApi ??= $parameter->getOpenApi();