@rjsf/utils 5.11.1 → 5.11.2

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
@@ -10,7 +10,7 @@ import isString from 'lodash-es/isString';
10
10
  import reduce from 'lodash-es/reduce';
11
11
  import times from 'lodash-es/times';
12
12
  import set from 'lodash-es/set';
13
- import forEach from 'lodash-es/forEach';
13
+ import transform from 'lodash-es/transform';
14
14
  import mergeAllOf from 'json-schema-merge-allof';
15
15
  import union from 'lodash-es/union';
16
16
  import isEqual from 'lodash-es/isEqual';
@@ -20,6 +20,7 @@ import { jsx } from 'react/jsx-runtime';
20
20
  import { createElement } from 'react';
21
21
  import ReactIs from 'react-is';
22
22
  import toPath from 'lodash-es/toPath';
23
+ import forEach from 'lodash-es/forEach';
23
24
 
24
25
  /** Determines whether a `thing` is an object for the purposes of RSJF. In this case, `thing` is an object if it has
25
26
  * the type `object` but is NOT null, an array or a File.
@@ -626,12 +627,19 @@ function resolveAllReferences(schema, rootSchema) {
626
627
  };
627
628
  }
628
629
  if (PROPERTIES_KEY in resolvedSchema) {
629
- forEach(resolvedSchema[PROPERTIES_KEY], (value, key) => {
630
- resolvedSchema[PROPERTIES_KEY][key] = resolveAllReferences(value, rootSchema);
631
- });
630
+ const updatedProps = transform(resolvedSchema[PROPERTIES_KEY], (result, value, key) => {
631
+ result[key] = resolveAllReferences(value, rootSchema);
632
+ }, {});
633
+ resolvedSchema = {
634
+ ...resolvedSchema,
635
+ [PROPERTIES_KEY]: updatedProps
636
+ };
632
637
  }
633
638
  if (ITEMS_KEY in resolvedSchema && !Array.isArray(resolvedSchema.items) && typeof resolvedSchema.items !== 'boolean') {
634
- resolvedSchema.items = resolveAllReferences(resolvedSchema.items, rootSchema);
639
+ resolvedSchema = {
640
+ ...resolvedSchema,
641
+ items: resolveAllReferences(resolvedSchema.items, rootSchema)
642
+ };
635
643
  }
636
644
  return resolvedSchema;
637
645
  }