This commit is contained in:
Christopher Davis 2021-11-06 07:35:50 -05:00
parent 76949ca537
commit 477442588a
5 changed files with 11 additions and 14 deletions

View File

@ -176,7 +176,7 @@ final class NelmioApiDocExtension extends Extension implements PrependExtensionI
new Reference('annotations.reader'),
$config['media_types'],
$jmsNamingStrategy,
$container->getParameter('nelmio_api_doc.use_validation_groups')
$container->getParameter('nelmio_api_doc.use_validation_groups'),
])
->addTag('nelmio_api_doc.model_describer', ['priority' => 50]);

View File

@ -11,10 +11,8 @@
namespace Nelmio\ApiDocBundle\Tests\Functional\Entity;
use Nelmio\ApiDocBundle\Tests\ModelDescriber\Annotations\Fixture as CustomAssert;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
class SymfonyConstraintsWithValidationGroups
{

View File

@ -19,9 +19,9 @@ use JMS\SerializerBundle\JMSSerializerBundle;
use Nelmio\ApiDocBundle\NelmioApiDocBundle;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\BazingaUser;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\JMSComplex;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyConstraintsWithValidationGroups;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\NestedGroup\JMSPicture;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\PrivateProtectedExposure;
use Nelmio\ApiDocBundle\Tests\Functional\Entity\SymfonyConstraintsWithValidationGroups;
use Nelmio\ApiDocBundle\Tests\Functional\ModelDescriber\VirtualTypeClassDoesNotExistsHandlerDefinedDescriber;
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
@ -33,7 +33,6 @@ use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Serializer\Annotation\SerializedName;
use Symfony\Component\Validator\Constraint;
class TestKernel extends Kernel
{

View File

@ -12,12 +12,12 @@
namespace Nelmio\ApiDocBundle\Tests\ModelDescriber\Annotations;
use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Validator\Constraint;
use Nelmio\ApiDocBundle\ModelDescriber\Annotations\SymfonyConstraintAnnotationReader;
use Nelmio\ApiDocBundle\Tests\Helper;
use Nelmio\ApiDocBundle\Tests\ModelDescriber\Annotations\Fixture as CustomAssert;
use OpenApi\Annotations as OA;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints as Assert;
class SymfonyConstraintAnnotationReaderTest extends TestCase
@ -488,7 +488,7 @@ class SymfonyConstraintAnnotationReaderTest extends TestCase
$reader->updateProperty(
new \ReflectionProperty($entity, 'property1'),
$schema->properties[0],
["other"],
['other'],
);
$this->assertSame(OA\UNDEFINED, $schema->required, 'should not have read constraint in default group');
@ -512,7 +512,7 @@ class SymfonyConstraintAnnotationReaderTest extends TestCase
$reader->updateProperty(
new \ReflectionProperty($entity, 'property1'),
$schema->properties[0],
["other", Constraint::DEFAULT_GROUP],
['other', Constraint::DEFAULT_GROUP],
);
$this->assertSame(['property1'], $schema->required, 'should have read constraint in default group');
@ -532,7 +532,7 @@ class SymfonyConstraintAnnotationReaderTest extends TestCase
if (\PHP_VERSION_ID >= 80000) {
yield 'Attributes' => [new class() {
#[Assert\NotBlank()]
#[Assert\Range(min: 1, group: ["other"])]
#[Assert\Range(min: 1, group: ['other'])]
private $property1;
}];
}