Skip to content

Commit a631e70

Browse files
committed
exclusiveMinimum is about minimum not minItems
1 parent 89d4a58 commit a631e70

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/JsonSchema/Constraints/UndefinedConstraint.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,8 @@ protected function applyDefaultValues(&$value, $schema, $path)
256256
$items = array();
257257
if (LooseTypeCheck::isArray($schema->items)) {
258258
$items = $schema->items;
259-
} elseif (isset($schema->minItems)) {
260-
$minItems = $schema->minItems;
261-
if (isset($schema->exclusiveMinimum) && $schema->exclusiveMinimum) {
262-
$minItems++;
263-
}
264-
if (count($value) < $minItems) {
265-
$items = array_fill(count($value), $minItems - count($value), $schema->items);
266-
}
259+
} elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
260+
$items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
267261
}
268262
// $value is an array, and items are defined - treat as plain array
269263
foreach ($items as $currentItem => $itemDefinition) {

tests/Constraints/DefaultPropertiesTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,6 @@ public function getValidTests()
164164
'{"items":{"default":"b"}, "minItems": 3}',
165165
'["a","b","b"]'
166166
),
167-
array(// #24 fill an array with an exclusiveMinimum
168-
'["a"]',
169-
'{"items":{"default":"b"}, "minItems": 3, "exclusiveMinimum": true}',
170-
'["a","b","b","b"]'
171-
),
172167
);
173168
}
174169

0 commit comments

Comments
 (0)