Skip to content

Commit

Permalink
Merge branch '3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhemN committed Sep 20, 2020
2 parents edd6857 + 6faec06 commit 416d1f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public function updateProperty($reflection, OA\Property $property): void

foreach ($annotations as $annotation) {
if ($annotation instanceof Assert\NotBlank || $annotation instanceof Assert\NotNull) {
if ($annotation instanceof Assert\NotBlank && $annotation->allowNull) {
// To support symfony/validator < 4.3
if ($annotation instanceof Assert\NotBlank && \method_exists($annotation, 'allowNull') && $annotation->allowNull) {
// The field is optional
continue;
}
Expand Down
3 changes: 0 additions & 3 deletions RouteDescriber/RouteDescriberTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
use OpenApi\Annotations\OpenApi;
use Symfony\Component\Routing\Route;

/**
* @internal
*/
trait RouteDescriberTrait
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public function testUpdatePropertyFix1283()

public function testOptionalProperty()
{
if (!\method_exists(Assert\NotBlank::class, 'allowNull')) {
$this->markTestSkipped('NotBlank::allowNull was added in symfony/validator 4.3.');
}

$entity = new class() {
/**
* @Assert\NotBlank(allowNull = true)
Expand Down

0 comments on commit 416d1f2

Please sign in to comment.