diff --git a/modules/openapi-generator/src/main/resources/php-symfony/api_input_validation.mustache b/modules/openapi-generator/src/main/resources/php-symfony/api_input_validation.mustache index 8c3a1d5e361..fca8dcd101b 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/api_input_validation.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/api_input_validation.mustache @@ -19,11 +19,11 @@ {{#items}} $asserts[] = new Assert\All([ new Assert\Type("{{dataType}}"), - {{^isPrimitiveType}} - new Assert\Valid(), - {{/isPrimitiveType}} ]); {{/items}} + {{^isPrimitiveType}} + $asserts[] = new Assert\Valid(); + {{/isPrimitiveType}} {{/isContainer}} {{^isContainer}} {{#isDate}} diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php index ba7ecc50c5c..ca07f62678d 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/PetController.php @@ -257,6 +257,7 @@ class PetController extends Controller $asserts[] = new Assert\All([ new Assert\Type("string"), ]); + $asserts[] = new Assert\Valid(); $response = $this->validate($status, $asserts); if ($response instanceof Response) { return $response; @@ -345,6 +346,7 @@ class PetController extends Controller $asserts[] = new Assert\All([ new Assert\Type("string"), ]); + $asserts[] = new Assert\Valid(); $response = $this->validate($tags, $asserts); if ($response instanceof Response) { return $response; diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php index 3328426b049..52af362ae34 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Controller/UserController.php @@ -163,8 +163,8 @@ class UserController extends Controller $asserts[] = new Assert\NotNull(); $asserts[] = new Assert\All([ new Assert\Type("OpenAPI\Server\Model\User"), - new Assert\Valid(), ]); + $asserts[] = new Assert\Valid(); $response = $this->validate($body, $asserts); if ($response instanceof Response) { return $response; @@ -242,8 +242,8 @@ class UserController extends Controller $asserts[] = new Assert\NotNull(); $asserts[] = new Assert\All([ new Assert\Type("OpenAPI\Server\Model\User"), - new Assert\Valid(), ]); + $asserts[] = new Assert\Valid(); $response = $this->validate($body, $asserts); if ($response instanceof Response) { return $response;