Skip to content

Commit 81d5d81

Browse files
authored
Update README.md
Update documentation to reflect the new options
1 parent 332db60 commit 81d5d81

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ User::export($user); // Exception: Required property missing: id at #->propertie
308308

309309
#### Nested structures
310310

311-
Nested structures allow you to make composition: flatten several objects in one and separate back.
311+
Nested structures allow you to make composition: flatten several objects in one and separate back. For nested structures that exceed a depth of the default 200 recursion limit, submit a Context maxNestLevel of an appropriate amount.
312312

313313
```php
314314
$user = new User();
@@ -462,14 +462,16 @@ $this->assertSame(4, $res->one);
462462
#### Overriding mapping classes
463463

464464
If you want to map data to a different class you can register mapping at top level of your importer structure.
465-
465+
Additionally, you can use the option property, maxNestLevel to increase your depth beyond the default 200 which may be
466+
useful for certain complex Schema's.
466467
```php
467468
class CustomSwaggerSchema extends SwaggerSchema
468469
{
469470
public static function import($data, ?Context $options = null)
470471
{
471472
if ($options === null) {
472473
$options = new Context();
474+
$options->maxNestLevel = 500;
473475
}
474476
$options->objectItemClassMapping[Schema::className()] = CustomSchema::className();
475477
return parent::import($data, $options);

0 commit comments

Comments
 (0)