-
-
Notifications
You must be signed in to change notification settings - Fork 895
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 skip remaining multiple union types (#6223)
- Loading branch information
1 parent
1cc114b
commit 818b9cd
Showing
6 changed files
with
175 additions
and
8 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
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,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <[email protected]> | ||
* | ||
* 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\Issue6212; | ||
|
||
interface Bird extends \JsonSerializable | ||
{ | ||
public function getName(): ?string; | ||
|
||
public function getAge(): ?int; | ||
} |
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,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <[email protected]> | ||
* | ||
* 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\Issue6212; | ||
|
||
final class Robin implements Bird | ||
{ | ||
public ?string $name = null; | ||
public ?int $age = null; | ||
|
||
public function getName(): ?string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function getAge(): ?int | ||
{ | ||
return $this->age; | ||
} | ||
|
||
public function jsonSerialize(): array | ||
{ | ||
return get_object_vars($this); | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <[email protected]> | ||
* | ||
* 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\Issue6212; | ||
|
||
final class Wren implements Bird | ||
{ | ||
public ?string $name = null; | ||
public ?int $age = null; | ||
public ?int $weight = null; | ||
|
||
public function getName(): ?string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function getAge(): ?int | ||
{ | ||
return $this->age; | ||
} | ||
|
||
public function jsonSerialize(): array | ||
{ | ||
return get_object_vars($this); | ||
} | ||
} |
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,50 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <[email protected]> | ||
* | ||
* 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\Entity\Issue6212; | ||
|
||
use ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6212\Bird; | ||
use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6212\Robin; | ||
use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6212\Wren; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ApiResource] | ||
#[ORM\Entity] | ||
class Nest | ||
{ | ||
#[ORM\Id] | ||
#[ORM\GeneratedValue] | ||
#[ORM\Column] | ||
private ?int $id = null; | ||
|
||
#[ORM\Column(type: 'json')] | ||
private ?Bird $owner; | ||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getOwner(): ?Bird | ||
{ | ||
return $this->owner; | ||
} | ||
|
||
public function setOwner(Wren|Robin|null $owner): static | ||
{ | ||
$this->owner = $owner; | ||
|
||
return $this; | ||
} | ||
} |
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