@rjsf/utils 5.13.2 → 5.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1577,16 +1577,43 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
1577
1577
  (0, import_set2.default)(pathSchema, RJSF_ADDITONAL_PROPERTIES_FLAG, true);
1578
1578
  }
1579
1579
  if (ITEMS_KEY in schema && Array.isArray(formData)) {
1580
- formData.forEach((element, i) => {
1581
- pathSchema[i] = toPathSchemaInternal(
1582
- validator,
1583
- schema.items,
1584
- `${name}.${i}`,
1585
- rootSchema,
1586
- element,
1587
- _recurseList
1588
- );
1589
- });
1580
+ const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
1581
+ if (Array.isArray(schemaItems)) {
1582
+ formData.forEach((element, i) => {
1583
+ if (schemaItems[i]) {
1584
+ pathSchema[i] = toPathSchemaInternal(
1585
+ validator,
1586
+ schemaItems[i],
1587
+ `${name}.${i}`,
1588
+ rootSchema,
1589
+ element,
1590
+ _recurseList
1591
+ );
1592
+ } else if (schemaAdditionalItems) {
1593
+ pathSchema[i] = toPathSchemaInternal(
1594
+ validator,
1595
+ schemaAdditionalItems,
1596
+ `${name}.${i}`,
1597
+ rootSchema,
1598
+ element,
1599
+ _recurseList
1600
+ );
1601
+ } else {
1602
+ console.warn(`Unable to generate path schema for "${name}.${i}". No schema defined for it`);
1603
+ }
1604
+ });
1605
+ } else {
1606
+ formData.forEach((element, i) => {
1607
+ pathSchema[i] = toPathSchemaInternal(
1608
+ validator,
1609
+ schemaItems,
1610
+ `${name}.${i}`,
1611
+ rootSchema,
1612
+ element,
1613
+ _recurseList
1614
+ );
1615
+ });
1616
+ }
1590
1617
  } else if (PROPERTIES_KEY in schema) {
1591
1618
  for (const property in schema.properties) {
1592
1619
  const field = (0, import_get10.default)(schema, [PROPERTIES_KEY, property]);