Skip to content

Commit 5b59616

Browse files
authored
Update RefResolver.php
Amazon JSON Schema for APPAREL apparently needs more than 400 nesting levels to resolve. Code updated to make it easy to adjust the hardcoded nesting level of 200.
1 parent 1f3a77a commit 5b59616

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/RefResolver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class RefResolver
1313
public $url;
1414
/** @var null|RefResolver */
1515
private $rootResolver;
16+
private static int $MAX_DEEP_NESTING = 500; //Change this if you receive DEEP_NESTING exceptions
1617

1718
/**
1819
* @param mixed $resolutionScope
@@ -224,7 +225,7 @@ public function resolveReference($referencePath)
224225
*/
225226
public function preProcessReferences($data, Context $options, $nestingLevel = 0)
226227
{
227-
if ($nestingLevel > 200) {
228+
if ($nestingLevel > self::$MAX_DEEP_NESTING) { //Updated due to specific recursion depth from Amazon product JSON Schemas - yep 200 was not enough
228229
throw new Exception('Too deep nesting level', Exception::DEEP_NESTING);
229230
}
230231
if (is_array($data)) {
@@ -264,4 +265,4 @@ public function preProcessReferences($data, Context $options, $nestingLevel = 0)
264265
}
265266

266267

267-
}
268+
}

0 commit comments

Comments
 (0)