diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index 02f14c0b..a1334a7b 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -280,8 +280,8 @@ protected function applyDefaultValues(&$value, $schema, $path) } else { $value[$currentItem] = $itemDefinition->default; } + $path->setFromDefault(); } - $path->setFromDefault(); } } elseif ( $value instanceof self diff --git a/tests/Constraints/DefaultPropertiesTest.php b/tests/Constraints/DefaultPropertiesTest.php index cc5eb909..1614d46c 100644 --- a/tests/Constraints/DefaultPropertiesTest.php +++ b/tests/Constraints/DefaultPropertiesTest.php @@ -164,6 +164,11 @@ public function getValidTests() '{"items":{"default":"b"}, "minItems": 3}', '["a","b","b"]' ), + array(// #24 items is an array of schema + '[{}]', + '{"items":[{"properties":{"propertyOne":{"default":"valueOne"}}}]}', + '[{"propertyOne":"valueOne"}]' + ), ); }