[php-symfony] remove nested Valid constraint (#8994)

* Fix constraint Valid cannot be nested

* Update PetController.php

* Update UserController.php
This commit is contained in:
vnq 2021-03-24 06:30:42 +01:00 committed by GitHub
parent f137f3331a
commit 74e5c3ccd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -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}}

View File

@ -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;

View File

@ -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;