diff --git a/src/JsonSchema/Constraints/UndefinedConstraint.php b/src/JsonSchema/Constraints/UndefinedConstraint.php index bea668a6..3b0c8eb0 100644 --- a/src/JsonSchema/Constraints/UndefinedConstraint.php +++ b/src/JsonSchema/Constraints/UndefinedConstraint.php @@ -265,6 +265,7 @@ protected function applyDefaultValues(&$value, $schema, $path) } // $value is an array, and items are defined - treat as plain array foreach ($items as $currentItem => $itemDefinition) { + $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition); if ( !array_key_exists($currentItem, $value) && property_exists($itemDefinition, 'default') diff --git a/tests/Constraints/DefaultPropertiesTest.php b/tests/Constraints/DefaultPropertiesTest.php index 8811f893..cc5eb909 100644 --- a/tests/Constraints/DefaultPropertiesTest.php +++ b/tests/Constraints/DefaultPropertiesTest.php @@ -126,7 +126,7 @@ public function getValidTests() ), array(// #16 infinite recursion via $ref (array) '[]', - '{"items":[{"$ref":"#","default":[]}]}', + '{"items":[{"$ref":"#","default":"valueOne"}], "default": []}', '[[]]' ), array(// #17 default top value does not overwrite defined null