-
Notifications
You must be signed in to change notification settings - Fork 937
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor enum fixtures into separate namespace (#1380)
- Loading branch information
1 parent
3b13725
commit 09356f4
Showing
8 changed files
with
135 additions
and
96 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,108 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* @license Apache 2.0 | ||
*/ | ||
|
||
namespace OpenApi\Tests\Fixtures\PHP\Enums; | ||
|
||
use OpenApi\Annotations as OA; | ||
use OpenApi\Attributes\Items; | ||
use OpenApi\Attributes\Property; | ||
use OpenApi\Attributes\Schema; | ||
|
||
#[Schema()] | ||
class ReferencesEnum | ||
{ | ||
#[Property( | ||
title: 'statusEnum', | ||
description: 'Status enum', | ||
type: 'string', | ||
enum: StatusEnum::class, | ||
nullable: false | ||
)] | ||
public string $statusEnum; | ||
|
||
#[Property( | ||
title: 'statusEnumMixed', | ||
description: 'Status enum mixed', | ||
type: 'string', | ||
enum: [StatusEnum::DRAFT, StatusEnum::ARCHIVED, 'OTHER'], | ||
nullable: false | ||
)] | ||
public string $statusEnumMixed; | ||
|
||
/** | ||
* @OA\Property(title="statusEnumBacked", | ||
* description="Status enum backed", | ||
* type="int", | ||
* enum="\OpenApi\Tests\Fixtures\PHP\Enums\StatusEnumBacked", | ||
* nullable="false" | ||
* ) | ||
*/ | ||
public int $statusEnumBacked; | ||
|
||
#[Property( | ||
title: 'statusEnumBackedMixed', | ||
description: 'Status enum backed mixed', | ||
type: 'int', | ||
enum: [StatusEnumBacked::DRAFT, StatusEnumBacked::ARCHIVED, 9], | ||
nullable: false | ||
)] | ||
public int $statusEnumBackedMixed; | ||
|
||
#[Property( | ||
title: 'statusEnumIntegerBacked', | ||
description: 'Status enum integer backed', | ||
type: 'int', | ||
enum: StatusEnumIntegerBacked::class, | ||
nullable: true | ||
)] | ||
public ?int $statusEnumIntegerBacked; | ||
|
||
/** | ||
* @OA\Property( | ||
* title="statusEnumStringBacked", | ||
* description="Status enum string backed", | ||
* type="string", | ||
* enum="\OpenApi\Tests\Fixtures\PHP\Enums\StatusEnumStringBacked", | ||
* nullable="true" | ||
* ) | ||
*/ | ||
public ?string $statusEnumStringBacked; | ||
|
||
#[Property( | ||
title: 'statusEnumStringBackedMixed', | ||
description: 'Status enum string backed mixed', | ||
type: 'string', | ||
enum: [StatusEnumStringBacked::DRAFT, StatusEnumStringBacked::ARCHIVED, 'other'], | ||
nullable: true | ||
)] | ||
public ?string $statusEnumStringBackedMixed; | ||
|
||
/** @var list<string> StatusEnumStringBacked array */ | ||
#[Property( | ||
title: 'statusEnums', | ||
description: 'StatusEnumStringBacked array', | ||
type: 'array', | ||
items: new Items( | ||
title: 'itemsStatusEnumStringBacked', | ||
type: 'string', | ||
enum: StatusEnumStringBacked::class | ||
) | ||
)] | ||
public array $statusEnums; | ||
|
||
/** @var list<string> StatusEnumStringBacked array */ | ||
#[Property( | ||
title: 'statusEnumsMixed', | ||
description: 'StatusEnumStringBacked array mixed', | ||
type: 'array', | ||
items: new Items( | ||
title: 'itemsStatusEnumStringBackedMixed', | ||
type: 'string', | ||
enum: [StatusEnumStringBacked::DRAFT, StatusEnumStringBacked::ARCHIVED, 'other'] | ||
) | ||
)] | ||
public array $statusEnumsMixed; | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
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