Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(jsonschema): don't try to define $ref if set in attributes (#6303)
- Loading branch information
1 parent
76af4ef
commit 6c3d58c
Showing
6 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/Fixtures/TestBundle/ApiResource/Issue6299/Issue6299.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6299; | ||
|
||
use ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Metadata\Get; | ||
|
||
#[ApiResource] | ||
#[Get(output: Issue6299OutputDto::class)] | ||
final class Issue6299 | ||
{ | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/Fixtures/TestBundle/ApiResource/Issue6299/Issue6299CollectionDto.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6299; | ||
|
||
final class Issue6299CollectionDto | ||
{ | ||
public string $name; | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/Fixtures/TestBundle/ApiResource/Issue6299/Issue6299ItemDto.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6299; | ||
|
||
final class Issue6299ItemDto | ||
{ | ||
public string $name; | ||
} |
39 changes: 39 additions & 0 deletions
39
tests/Fixtures/TestBundle/ApiResource/Issue6299/Issue6299OutputDto.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6299; | ||
|
||
use ApiPlatform\Metadata\ApiProperty; | ||
use Symfony\Component\Serializer\Attribute\Groups; | ||
|
||
final class Issue6299OutputDto | ||
{ | ||
#[ApiProperty( | ||
openapiContext: ['$ref' => '#/components/schemas/DummyFriend'], | ||
jsonSchemaContext: ['$ref' => '#/definitions/DummyFriend'], | ||
)] | ||
#[Groups(['v1.read', 'v2.read'])] | ||
public Issue6299ItemDto $itemDto; | ||
|
||
#[ApiProperty( | ||
openapiContext: [ | ||
'items' => ['$ref' => '#/components/schemas/DummyDate'], | ||
], | ||
jsonSchemaContext: [ | ||
'items' => ['$ref' => '#/definitions/DummyDate'], | ||
], | ||
)] | ||
#[Groups(['v1.read', 'v2.read'])] | ||
/** @var Issue6299CollectionDto[] */ | ||
public array $collectionDto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters