| 1 |
<?php declare(strict_types=1); |
| 2 |
|
| 3 |
/** |
| 4 |
* @license Apache 2.0 |
| 5 |
*/ |
| 6 |
|
| 7 |
namespace OpenApi\Attributes; |
| 8 |
|
| 9 |
use OpenApi\Annotations as OA; |
| 10 |
use OpenApi\Generator; |
| 11 |
|
| 12 |
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD)] |
| 13 |
class Items extends OA\Items |
| 14 |
{ |
| 15 |
/** |
| 16 |
* @param string|class-string|object|null $ref |
| 17 |
* * @param list<string> $required |
| 18 |
* * @param list<Property> $properties |
| 19 |
* * @param string|non-empty-array<string>|null $type |
| 20 |
* * @param array<Examples> $examples |
| 21 |
* * @param array<Schema|OA\Schema> $allOf |
| 22 |
* * @param array<Schema|OA\Schema> $anyOf |
| 23 |
* * @param array<Schema|OA\Schema> $oneOf |
| 24 |
* * @param list<string|int|float|bool|\UnitEnum|null>|class-string|null $enum |
| 25 |
* * @param array<string,mixed>|null $x |
| 26 |
* * @param list<Attachable>|null $attachables |
| 27 |
*/ |
| 28 |
public function __construct( |
| 29 |
// Schema |
| 30 |
string|object|null $ref = null, |
| 31 |
?string $schema = null, |
| 32 |
?string $title = null, |
| 33 |
?string $description = Generator::UNDEFINED, |
| 34 |
?int $maxProperties = null, |
| 35 |
?int $minProperties = null, |
| 36 |
?array $required = null, |
| 37 |
?array $properties = null, |
| 38 |
string|array|null $type = null, |
| 39 |
?string $format = null, |
| 40 |
?Items $items = null, |
| 41 |
?string $collectionFormat = null, |
| 42 |
?string $pattern = null, |
| 43 |
?Discriminator $discriminator = null, |
| 44 |
?bool $readOnly = null, |
| 45 |
?bool $writeOnly = null, |
| 46 |
?Xml $xml = null, |
| 47 |
?ExternalDocumentation $externalDocs = null, |
| 48 |
mixed $example = Generator::UNDEFINED, |
| 49 |
?array $examples = null, |
| 50 |
?bool $nullable = null, |
| 51 |
?bool $deprecated = null, |
| 52 |
?array $allOf = null, |
| 53 |
?array $anyOf = null, |
| 54 |
?array $oneOf = null, |
| 55 |
?string $contentEncoding = null, |
| 56 |
?string $contentMediaType = null, |
| 57 |
|
| 58 |
// JSON Schema |
| 59 |
mixed $default = Generator::UNDEFINED, |
| 60 |
int|float|null $maximum = null, |
| 61 |
bool|int|float|null $exclusiveMaximum = null, |
| 62 |
int|float|null $minimum = null, |
| 63 |
bool|int|float|null $exclusiveMinimum = null, |
| 64 |
int|null $maxLength = null, |
| 65 |
int|null $minLength = null, |
| 66 |
int|null $maxItems = null, |
| 67 |
int|null $minItems = null, |
| 68 |
bool|null $uniqueItems = null, |
| 69 |
array|string|null $enum = null, |
| 70 |
mixed $not = Generator::UNDEFINED, |
| 71 |
bool|AdditionalProperties|null $additionalProperties = null, |
| 72 |
array|null $additionalItems = null, |
| 73 |
array|null $contains = null, |
| 74 |
array|null $patternProperties = null, |
| 75 |
array|null $unevaluatedProperties = null, |
| 76 |
mixed $dependencies = Generator::UNDEFINED, |
| 77 |
mixed $propertyNames = Generator::UNDEFINED, |
| 78 |
mixed $const = Generator::UNDEFINED, |
| 79 |
|
| 80 |
// abstract annotation |
| 81 |
?array $x = null, |
| 82 |
?array $attachables = null |
| 83 |
) { |
| 84 |
parent::__construct([ |
| 85 |
// Schema |
| 86 |
'ref' => $ref ?? Generator::UNDEFINED, |
| 87 |
'schema' => $schema ?? Generator::UNDEFINED, |
| 88 |
'title' => $title ?? Generator::UNDEFINED, |
| 89 |
'description' => $description, |
| 90 |
'maxProperties' => $maxProperties ?? Generator::UNDEFINED, |
| 91 |
'minProperties' => $minProperties ?? Generator::UNDEFINED, |
| 92 |
'required' => $required ?? Generator::UNDEFINED, |
| 93 |
'properties' => $properties ?? Generator::UNDEFINED, |
| 94 |
'type' => $type ?? Generator::UNDEFINED, |
| 95 |
'format' => $format ?? Generator::UNDEFINED, |
| 96 |
'collectionFormat' => $collectionFormat ?? Generator::UNDEFINED, |
| 97 |
'pattern' => $pattern ?? Generator::UNDEFINED, |
| 98 |
'readOnly' => $readOnly ?? Generator::UNDEFINED, |
| 99 |
'writeOnly' => $writeOnly ?? Generator::UNDEFINED, |
| 100 |
'xml' => $xml ?? Generator::UNDEFINED, |
| 101 |
'example' => $example, |
| 102 |
'nullable' => $nullable ?? Generator::UNDEFINED, |
| 103 |
'deprecated' => $deprecated ?? Generator::UNDEFINED, |
| 104 |
'allOf' => $allOf ?? Generator::UNDEFINED, |
| 105 |
'anyOf' => $anyOf ?? Generator::UNDEFINED, |
| 106 |
'oneOf' => $oneOf ?? Generator::UNDEFINED, |
| 107 |
'contentEncoding' => $contentEncoding ?? Generator::UNDEFINED, |
| 108 |
'contentMediaType' => $contentMediaType ?? Generator::UNDEFINED, |
| 109 |
|
| 110 |
// JSON Schema |
| 111 |
'default' => $default, |
| 112 |
'maximum' => $maximum ?? Generator::UNDEFINED, |
| 113 |
'exclusiveMaximum' => $exclusiveMaximum ?? Generator::UNDEFINED, |
| 114 |
'minimum' => $minimum ?? Generator::UNDEFINED, |
| 115 |
'exclusiveMinimum' => $exclusiveMinimum ?? Generator::UNDEFINED, |
| 116 |
'maxLength' => $maxLength ?? Generator::UNDEFINED, |
| 117 |
'minLength' => $minLength ?? Generator::UNDEFINED, |
| 118 |
'maxItems' => $maxItems ?? Generator::UNDEFINED, |
| 119 |
'minItems' => $minItems ?? Generator::UNDEFINED, |
| 120 |
'uniqueItems' => $uniqueItems ?? Generator::UNDEFINED, |
| 121 |
'enum' => $enum ?? Generator::UNDEFINED, |
| 122 |
'not' => $not, |
| 123 |
'additionalProperties' => $additionalProperties ?? Generator::UNDEFINED, |
| 124 |
'additionalItems' => $additionalItems ?? Generator::UNDEFINED, |
| 125 |
'contains' => $contains ?? Generator::UNDEFINED, |
| 126 |
'patternProperties' => $patternProperties ?? Generator::UNDEFINED, |
| 127 |
'unevaluatedProperties' => $unevaluatedProperties ?? Generator::UNDEFINED, |
| 128 |
'dependencies' => $dependencies, |
| 129 |
'propertyNames' => $propertyNames, |
| 130 |
'const' => $const, |
| 131 |
|
| 132 |
// abstract annotation |
| 133 |
'x' => $x ?? Generator::UNDEFINED, |
| 134 |
'attachables' => $attachables ?? Generator::UNDEFINED, |
| 135 |
'value' => $this->combine($items, $discriminator, $externalDocs, $examples), |
| 136 |
]); |
| 137 |
} |
| 138 |
} |