@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/utils.esm.js CHANGED
@@ -1443,16 +1443,43 @@ function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _re
1443
1443
  set2(pathSchema, RJSF_ADDITONAL_PROPERTIES_FLAG, true);
1444
1444
  }
1445
1445
  if (ITEMS_KEY in schema && Array.isArray(formData)) {
1446
- formData.forEach((element, i) => {
1447
- pathSchema[i] = toPathSchemaInternal(
1448
- validator,
1449
- schema.items,
1450
- `${name}.${i}`,
1451
- rootSchema,
1452
- element,
1453
- _recurseList
1454
- );
1455
- });
1446
+ const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
1447
+ if (Array.isArray(schemaItems)) {
1448
+ formData.forEach((element, i) => {
1449
+ if (schemaItems[i]) {
1450
+ pathSchema[i] = toPathSchemaInternal(
1451
+ validator,
1452
+ schemaItems[i],
1453
+ `${name}.${i}`,
1454
+ rootSchema,
1455
+ element,
1456
+ _recurseList
1457
+ );
1458
+ } else if (schemaAdditionalItems) {
1459
+ pathSchema[i] = toPathSchemaInternal(
1460
+ validator,
1461
+ schemaAdditionalItems,
1462
+ `${name}.${i}`,
1463
+ rootSchema,
1464
+ element,
1465
+ _recurseList
1466
+ );
1467
+ } else {
1468
+ console.warn(`Unable to generate path schema for "${name}.${i}". No schema defined for it`);
1469
+ }
1470
+ });
1471
+ } else {
1472
+ formData.forEach((element, i) => {
1473
+ pathSchema[i] = toPathSchemaInternal(
1474
+ validator,
1475
+ schemaItems,
1476
+ `${name}.${i}`,
1477
+ rootSchema,
1478
+ element,
1479
+ _recurseList
1480
+ );
1481
+ });
1482
+ }
1456
1483
  } else if (PROPERTIES_KEY in schema) {
1457
1484
  for (const property in schema.properties) {
1458
1485
  const field = get10(schema, [PROPERTIES_KEY, property]);