| 1 |
<?php declare(strict_types=1); |
| 2 |
|
| 3 |
/** |
| 4 |
* @license Apache 2.0 |
| 5 |
*/ |
| 6 |
|
| 7 |
namespace OpenApi\Annotations; |
| 8 |
|
| 9 |
use OpenApi\Generator; |
| 10 |
|
| 11 |
/** |
| 12 |
* Sets a default value to the parameter. The type of the value depends on the defined type. |
| 13 |
* |
| 14 |
* @see [JSON schema validation](http://json-schema.org/latest/json-schema-validation.html) |
| 15 |
*/ |
| 16 |
trait JsonSchemaTrait |
| 17 |
{ |
| 18 |
/** |
| 19 |
* Sets a default value to the parameter. |
| 20 |
* |
| 21 |
* The type of the value depends on the defined type. |
| 22 |
* |
| 23 |
* @var mixed |
| 24 |
*/ |
| 25 |
public $default = Generator::UNDEFINED; |
| 26 |
|
| 27 |
/** |
| 28 |
* The maximum value allowed for a numeric property. This value must be a number. |
| 29 |
* |
| 30 |
* @var int|float |
| 31 |
*/ |
| 32 |
public $maximum = Generator::UNDEFINED; |
| 33 |
|
| 34 |
/** |
| 35 |
* A boolean indicating whether the maximum value is excluded from the set of valid values. |
| 36 |
* |
| 37 |
* When set to true, the maximum value is excluded, and when false or not specified, it is included. |
| 38 |
* |
| 39 |
* @var bool|int|float |
| 40 |
*/ |
| 41 |
public $exclusiveMaximum = Generator::UNDEFINED; |
| 42 |
|
| 43 |
/** |
| 44 |
* The minimum value allowed for a numeric property. This value must be a number. |
| 45 |
* |
| 46 |
* @var int|float |
| 47 |
*/ |
| 48 |
public $minimum = Generator::UNDEFINED; |
| 49 |
|
| 50 |
/** |
| 51 |
* A boolean indicating whether the minimum value is excluded from the set of valid values. |
| 52 |
* |
| 53 |
* When set to true, the minimum value is excluded, and when false or not specified, it is included. |
| 54 |
* |
| 55 |
* @var bool|int|float |
| 56 |
*/ |
| 57 |
public $exclusiveMinimum = Generator::UNDEFINED; |
| 58 |
|
| 59 |
/** |
| 60 |
* The maximum length of a string property. |
| 61 |
* |
| 62 |
* A string instance is valid against this property if its length is less than, or equal to, the value of this |
| 63 |
* attribute. |
| 64 |
* |
| 65 |
* @var int |
| 66 |
*/ |
| 67 |
public $maxLength = Generator::UNDEFINED; |
| 68 |
|
| 69 |
/** |
| 70 |
* The minimum length of a string property. |
| 71 |
* |
| 72 |
* A string instance is valid against this property if its length is greater than, or equal to, the value of this |
| 73 |
* attribute. |
| 74 |
* |
| 75 |
* @var int |
| 76 |
*/ |
| 77 |
public $minLength = Generator::UNDEFINED; |
| 78 |
|
| 79 |
/** |
| 80 |
* The maximum number of items allowed in an array property. |
| 81 |
* |
| 82 |
* An array instance is valid against this property if its number of items is less than, or equal to, the value of |
| 83 |
* this attribute. |
| 84 |
* |
| 85 |
* @var int |
| 86 |
*/ |
| 87 |
public $maxItems = Generator::UNDEFINED; |
| 88 |
|
| 89 |
/** |
| 90 |
* The minimum number of items allowed in an array property. |
| 91 |
* |
| 92 |
* An array instance is valid against this property if its number of items is greater than, or equal to, the value |
| 93 |
* of this attribute. |
| 94 |
* |
| 95 |
* @var int |
| 96 |
*/ |
| 97 |
public $minItems = Generator::UNDEFINED; |
| 98 |
|
| 99 |
/** |
| 100 |
* A boolean value indicating whether all items in an array property must be unique. |
| 101 |
* |
| 102 |
* If this attribute is set to true, then all items in the array must be unique. |
| 103 |
* |
| 104 |
* @var bool |
| 105 |
*/ |
| 106 |
public $uniqueItems = Generator::UNDEFINED; |
| 107 |
|
| 108 |
/** |
| 109 |
* A list of allowable values for a property. |
| 110 |
* |
| 111 |
* A property instance is valid against this attribute if its value is one of the values specified in this |
| 112 |
* list. |
| 113 |
* |
| 114 |
* @var list<string|int|float|bool|\UnitEnum>|class-string |
| 115 |
*/ |
| 116 |
public $enum = Generator::UNDEFINED; |
| 117 |
|
| 118 |
/** |
| 119 |
* @var mixed |
| 120 |
*/ |
| 121 |
public $not = Generator::UNDEFINED; |
| 122 |
|
| 123 |
/** |
| 124 |
* @var bool|AdditionalProperties |
| 125 |
*/ |
| 126 |
public $additionalProperties = Generator::UNDEFINED; |
| 127 |
|
| 128 |
/** |
| 129 |
* @var array |
| 130 |
*/ |
| 131 |
public $additionalItems = Generator::UNDEFINED; |
| 132 |
|
| 133 |
/** |
| 134 |
* @var array |
| 135 |
*/ |
| 136 |
public $contains = Generator::UNDEFINED; |
| 137 |
|
| 138 |
/** |
| 139 |
* @var array |
| 140 |
*/ |
| 141 |
public $patternProperties = Generator::UNDEFINED; |
| 142 |
|
| 143 |
/** |
| 144 |
* @var array |
| 145 |
*/ |
| 146 |
public $unevaluatedProperties = Generator::UNDEFINED; |
| 147 |
|
| 148 |
/** |
| 149 |
* @var mixed |
| 150 |
*/ |
| 151 |
public $dependencies = Generator::UNDEFINED; |
| 152 |
|
| 153 |
/** |
| 154 |
* @var mixed |
| 155 |
*/ |
| 156 |
public $propertyNames = Generator::UNDEFINED; |
| 157 |
|
| 158 |
/** |
| 159 |
* @var mixed |
| 160 |
* @since OpenAPI 3.1.0 |
| 161 |
*/ |
| 162 |
public $const = Generator::UNDEFINED; |
| 163 |
} |
| 164 |
|
| 165 |
/* |
| 166 |
* Template code to be used by all attributes extending OA\Schema. |
| 167 |
* |
| 168 |
* |
| 169 |
** TYPE-HINTS: |
| 170 |
|
| 171 |
* @param list<string|int|float|bool|\UnitEnum|null>|class-string|null $enum |
| 172 |
|
| 173 |
|
| 174 |
** PARAMETERS: |
| 175 |
|
| 176 |
// JSON Schema |
| 177 |
mixed $default = Generator::UNDEFINED, |
| 178 |
int|float|null $maximum = null, |
| 179 |
bool|int|float|null $exclusiveMaximum = null, |
| 180 |
int|float|null $minimum = null, |
| 181 |
bool|int|float|null $exclusiveMinimum = null, |
| 182 |
int|null $maxLength = null, |
| 183 |
int|null $minLength = null, |
| 184 |
int|null $maxItems = null, |
| 185 |
int|null $minItems = null, |
| 186 |
bool|null $uniqueItems = null, |
| 187 |
array|string|null $enum = null, |
| 188 |
mixed $not = Generator::UNDEFINED, |
| 189 |
bool|AdditionalProperties|null $additionalProperties = null, |
| 190 |
array|null $additionalItems = null, |
| 191 |
array|null $contains = null, |
| 192 |
array|null $patternProperties = null, |
| 193 |
array|null $unevaluatedProperties = null, |
| 194 |
mixed $dependencies = Generator::UNDEFINED, |
| 195 |
mixed $propertyNames = Generator::UNDEFINED, |
| 196 |
mixed $const = Generator::UNDEFINED, |
| 197 |
|
| 198 |
|
| 199 |
** PARENT-PARAMS: |
| 200 |
|
| 201 |
// JSON Schema |
| 202 |
'default' => $default, |
| 203 |
'maximum' => $maximum ?? Generator::UNDEFINED, |
| 204 |
'exclusiveMaximum' => $exclusiveMaximum ?? Generator::UNDEFINED, |
| 205 |
'minimum' => $minimum ?? Generator::UNDEFINED, |
| 206 |
'exclusiveMinimum' => $exclusiveMinimum ?? Generator::UNDEFINED, |
| 207 |
'maxLength' => $maxLength ?? Generator::UNDEFINED, |
| 208 |
'minLength' => $minLength ?? Generator::UNDEFINED, |
| 209 |
'maxItems' => $maxItems ?? Generator::UNDEFINED, |
| 210 |
'minItems' => $minItems ?? Generator::UNDEFINED, |
| 211 |
'uniqueItems' => $uniqueItems ?? Generator::UNDEFINED, |
| 212 |
'enum' => $enum ?? Generator::UNDEFINED, |
| 213 |
'not' => $not, |
| 214 |
'additionalProperties' => $additionalProperties ?? Generator::UNDEFINED, |
| 215 |
'additionalItems' => $additionalItems ?? Generator::UNDEFINED, |
| 216 |
'contains' => $contains ?? Generator::UNDEFINED, |
| 217 |
'patternProperties' => $patternProperties ?? Generator::UNDEFINED, |
| 218 |
'unevaluatedProperties' => $unevaluatedProperties ?? Generator::UNDEFINED, |
| 219 |
'dependencies' => $dependencies, |
| 220 |
'propertyNames' => $propertyNames, |
| 221 |
'const' => $const, |
| 222 |
|
| 223 |
*/ |