Skip to content

Commit b0c8265

Browse files
committed
Apply constraint to items
1 parent 0db87c8 commit b0c8265

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/compileValueSchema.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ export function compileValueSchema(
5050
additionalProperties: { ...resolved.additionalProperties, ...constraints },
5151
});
5252
}
53+
54+
// Apply the constraints to the items schema if it exists
55+
if (resolved.type === 'array' && typeof resolved.items === 'object') {
56+
return compileValueSchema(compiler, {
57+
...resolved,
58+
items: { ...resolved.items, ...constraints },
59+
});
60+
}
61+
5362
// Otherwise merge directly into the resolved schema
5463
return compileValueSchema(compiler, { ...resolved, ...constraints });
5564
}

0 commit comments

Comments
 (0)