From a54ba4b5dd3a24540e011ce2575a8f2c372566f6 Mon Sep 17 00:00:00 2001 From: Dan Ackroyd Date: Mon, 21 May 2018 14:46:55 +0100 Subject: [PATCH 1/2] Fix missing deref. --- src/JsonSchema/Constraints/CollectionConstraint.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/JsonSchema/Constraints/CollectionConstraint.php b/src/JsonSchema/Constraints/CollectionConstraint.php index 18f0efd9..7ae792e1 100644 --- a/src/JsonSchema/Constraints/CollectionConstraint.php +++ b/src/JsonSchema/Constraints/CollectionConstraint.php @@ -64,6 +64,10 @@ public function check(&$value, $schema = null, JsonPointer $path = null, $i = nu */ protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null) { + if (is_array($schema->items) && array_key_exists('$ref', $schema->items)) { + $schema->items = $this->factory->getSchemaStorage()->resolveRefSchema((object)$schema->items); + }; + if (is_object($schema->items)) { // just one type definition for the whole array From 1ca1b138491b695eb47783eb4b3feb75b6cff904 Mon Sep 17 00:00:00 2001 From: Dan Ackroyd Date: Mon, 21 May 2018 15:21:16 +0100 Subject: [PATCH 2/2] CS. --- src/JsonSchema/Constraints/CollectionConstraint.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/JsonSchema/Constraints/CollectionConstraint.php b/src/JsonSchema/Constraints/CollectionConstraint.php index 7ae792e1..af009d91 100644 --- a/src/JsonSchema/Constraints/CollectionConstraint.php +++ b/src/JsonSchema/Constraints/CollectionConstraint.php @@ -65,8 +65,8 @@ public function check(&$value, $schema = null, JsonPointer $path = null, $i = nu protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null) { if (is_array($schema->items) && array_key_exists('$ref', $schema->items)) { - $schema->items = $this->factory->getSchemaStorage()->resolveRefSchema((object)$schema->items); - }; + $schema->items = $this->factory->getSchemaStorage()->resolveRefSchema((object) $schema->items); + } if (is_object($schema->items)) { // just one type definition for the whole array