diff --git a/src/__tests__/__snapshots__/tree.spec.ts.snap b/src/__tests__/__snapshots__/tree.spec.ts.snap index 7d62e66..28d8a9e 100644 --- a/src/__tests__/__snapshots__/tree.spec.ts.snap +++ b/src/__tests__/__snapshots__/tree.spec.ts.snap @@ -300,7 +300,10 @@ exports[`SchemaTree output should generate valid tree for arrays/additional-empt "└─ # ├─ types │ └─ 0: array - └─ primaryType: array + ├─ primaryType: array + └─ children + └─ 0 + └─ #/additionalItems " `; @@ -308,7 +311,11 @@ exports[`SchemaTree output should generate valid tree for arrays/additional-fals "└─ # ├─ types │ └─ 0: array - └─ primaryType: array + ├─ primaryType: array + └─ children + └─ 0 + └─ #/additionalItems + └─ value: false " `; @@ -316,7 +323,19 @@ exports[`SchemaTree output should generate valid tree for arrays/additional-sche "└─ # ├─ types │ └─ 0: array - └─ primaryType: array + ├─ primaryType: array + └─ children + └─ 0 + └─ #/additionalItems + ├─ types + │ └─ 0: object + ├─ primaryType: object + └─ children + └─ 0 + └─ #/additionalItems/properties/baz + ├─ types + │ └─ 0: number + └─ primaryType: number " `; @@ -324,7 +343,11 @@ exports[`SchemaTree output should generate valid tree for arrays/additional-true "└─ # ├─ types │ └─ 0: array - └─ primaryType: array + ├─ primaryType: array + └─ children + └─ 0 + └─ #/additionalItems + └─ value: true " `; diff --git a/src/walker/walker.ts b/src/walker/walker.ts index 9ccc92c..02efbd5 100644 --- a/src/walker/walker.ts +++ b/src/walker/walker.ts @@ -222,11 +222,20 @@ export class Walker extends EventEmitter { this.path.push('items', String(i)); this.walk(); } - } else if (isObjectLiteral(fragment.items)) { - this.fragment = fragment.items; - this.restoreInternalWalkerState(state); - this.path.push('items'); - this.walk(); + } else { + if (isObjectLiteral(fragment.items)) { + this.fragment = fragment.items; + this.restoreInternalWalkerState(state); + this.path.push('items'); + this.walk(); + } + + if (isValidSchemaFragment(fragment.additionalItems)) { + this.fragment = fragment.additionalItems; + this.restoreInternalWalkerState(state); + this.path.push('additionalItems'); + this.walk(); + } } break;