|
26 | 26 | * @property string $title
|
27 | 27 | * @property int|float $multipleOf
|
28 | 28 | * @property int|float $maximum
|
29 |
| - * @property bool $exclusiveMaximum |
| 29 | + * @property bool|int|float $exclusiveMaximum |
30 | 30 | * @property int|float $minimum
|
31 |
| - * @property bool $exclusiveMinimum |
| 31 | + * @property bool|int|float $exclusiveMinimum |
32 | 32 | * @property int $maxLength
|
33 | 33 | * @property int $minLength
|
34 | 34 | * @property string $pattern (This string SHOULD be a valid regular expression, according to the [ECMA 262 regular expression dialect](https://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5))
|
@@ -75,9 +75,9 @@ protected function attributes(): array
|
75 | 75 | 'title' => Type::STRING,
|
76 | 76 | 'multipleOf' => Type::NUMBER,
|
77 | 77 | 'maximum' => Type::NUMBER,
|
78 |
| - 'exclusiveMaximum' => Type::BOOLEAN, |
| 78 | + // 'exclusiveMaximum' => 'boolean' for 3.0 or 'number' for 3.1, handled in constructor, |
79 | 79 | 'minimum' => Type::NUMBER,
|
80 |
| - 'exclusiveMinimum' => Type::BOOLEAN, |
| 80 | + // 'exclusiveMinimum' => 'boolean' for 3.0 or 'number' for 3.1, handled in constructor, |
81 | 81 | 'maxLength' => Type::INTEGER,
|
82 | 82 | 'minLength' => Type::INTEGER,
|
83 | 83 | 'pattern' => Type::STRING,
|
@@ -151,6 +151,15 @@ public function __construct(array $data)
|
151 | 151 | throw new TypeErrorException(sprintf('Schema::$additionalProperties MUST be either boolean or a Schema/Reference object, "%s" given', $givenType));
|
152 | 152 | }
|
153 | 153 | }
|
| 154 | + |
| 155 | + if (isset($data['exclusiveMaximum']) && !in_array(gettype($data['exclusiveMaximum']), ['boolean', 'double', 'integer'])) { |
| 156 | + throw new TypeErrorException(sprintf('Schema::$exclusiveMinimum MUST be either boolean or a number, "%s" given', gettype($data['exclusiveMaximum']))); |
| 157 | + } |
| 158 | + |
| 159 | + if (isset($data['exclusiveMinimum']) && !in_array(gettype($data['exclusiveMinimum']), ['boolean', 'double', 'integer'])) { |
| 160 | + throw new TypeErrorException(sprintf('Schema::$exclusiveMinimum MUST be either boolean or a number, "%s" given', gettype($data['exclusiveMinimum']))); |
| 161 | + } |
| 162 | + |
154 | 163 | parent::__construct($data);
|
155 | 164 | }
|
156 | 165 |
|
|
0 commit comments