Skip to content

Commit

Permalink
fix non-existing uuid 7 & 8 in Symfony 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
DjordyKoert committed Jan 18, 2025
1 parent 5589601 commit 3851753
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 15 deletions.
12 changes: 1 addition & 11 deletions tests/Functional/ModelDescriber/Fixtures/UuidClass.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"uuidV3",
"uuidV4",
"uuidV5",
"uuidV6",
"uuidV7",
"uuidV8"
"uuidV6"
],
"properties": {
"uuid": {
Expand Down Expand Up @@ -39,14 +37,6 @@
"type": "string",
"format": "uuid"
},
"uuidV7": {
"type": "string",
"format": "uuid"
},
"uuidV8": {
"type": "string",
"format": "uuid"
},
"nullableUuid": {
"type": "string",
"format": "uuid",
Expand Down
4 changes: 0 additions & 4 deletions tests/Functional/ModelDescriber/Fixtures/UuidClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
use Symfony\Component\Uid\UuidV4;
use Symfony\Component\Uid\UuidV5;
use Symfony\Component\Uid\UuidV6;
use Symfony\Component\Uid\UuidV7;
use Symfony\Component\Uid\UuidV8;

class UuidClass
{
Expand All @@ -30,8 +28,6 @@ class UuidClass
public UuidV4 $uuidV4;
public UuidV5 $uuidV5;
public UuidV6 $uuidV6;
public UuidV7 $uuidV7;
public UuidV8 $uuidV8;

public ?Uuid $nullableUuid;
}
57 changes: 57 additions & 0 deletions tests/Functional/ModelDescriber/Fixtures/UuidClass7And8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"required": [
"uuid",
"ulid",
"uuidV1",
"uuidV3",
"uuidV4",
"uuidV5",
"uuidV6",
"uuidV7",
"uuidV8"
],
"properties": {
"uuid": {
"type": "string",
"format": "uuid"
},
"ulid": {
"type": "string",
"format": "uuid"
},
"uuidV1": {
"type": "string",
"format": "uuid"
},
"uuidV3": {
"type": "string",
"format": "uuid"
},
"uuidV4": {
"type": "string",
"format": "uuid"
},
"uuidV5": {
"type": "string",
"format": "uuid"
},
"uuidV6": {
"type": "string",
"format": "uuid"
},
"uuidV7": {
"type": "string",
"format": "uuid"
},
"uuidV8": {
"type": "string",
"format": "uuid"
},
"nullableUuid": {
"type": "string",
"format": "uuid",
"nullable": true
}
},
"type": "object"
}
37 changes: 37 additions & 0 deletions tests/Functional/ModelDescriber/Fixtures/UuidClass7And8.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\Tests\Functional\ModelDescriber\Fixtures;

use Symfony\Component\Uid\Ulid;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Uid\UuidV1;
use Symfony\Component\Uid\UuidV3;
use Symfony\Component\Uid\UuidV4;
use Symfony\Component\Uid\UuidV5;
use Symfony\Component\Uid\UuidV6;
use Symfony\Component\Uid\UuidV7;
use Symfony\Component\Uid\UuidV8;

class UuidClass7And8
{
public Uuid $uuid;
public Ulid $ulid;
public UuidV1 $uuidV1;
public UuidV3 $uuidV3;
public UuidV4 $uuidV4;
public UuidV5 $uuidV5;
public UuidV6 $uuidV6;
public UuidV7 $uuidV7;
public UuidV8 $uuidV8;

public ?Uuid $nullableUuid;
}
7 changes: 7 additions & 0 deletions tests/Functional/ModelDescriber/ObjectModelDescriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Nelmio\ApiDocBundle\Tests\Functional\WebTestCase;
use OpenApi\Annotations as OA;
use OpenApi\Annotations\OpenApi;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\PropertyInfo\Type as LegacyType;

class ObjectModelDescriberTest extends WebTestCase
Expand Down Expand Up @@ -105,6 +106,12 @@ public static function provideFixtures(): \Generator
Fixtures\UuidClass::class
];

if (version_compare(Kernel::VERSION, '6.4.0', '>=')) {
yield [
Fixtures\UuidClass7And8::class
];
}

yield [
Fixtures\Refs::class
];
Expand Down

0 comments on commit 3851753

Please sign in to comment.