@rjsf/utils 5.21.0 → 5.21.1

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.
@@ -1,4 +1,5 @@
1
1
  import get from 'lodash/get';
2
+ import isEqual from 'lodash/isEqual';
2
3
  import set from 'lodash/set';
3
4
  import times from 'lodash/times';
4
5
  import transform from 'lodash/transform';
@@ -14,10 +15,10 @@ import {
14
15
  ANY_OF_KEY,
15
16
  DEPENDENCIES_KEY,
16
17
  IF_KEY,
17
- ITEMS_KEY,
18
18
  ONE_OF_KEY,
19
- PROPERTIES_KEY,
20
19
  REF_KEY,
20
+ PROPERTIES_KEY,
21
+ ITEMS_KEY,
21
22
  } from '../constants';
22
23
  import findSchemaDefinition, { splitKeyElementFromObject } from '../findSchemaDefinition';
23
24
  import getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema';
@@ -26,7 +27,6 @@ import isObject from '../isObject';
26
27
  import mergeSchemas from '../mergeSchemas';
27
28
  import { FormContextType, GenericObjectType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
28
29
  import getFirstMatchingOption from './getFirstMatchingOption';
29
- import deepEquals from '../deepEquals';
30
30
 
31
31
  /** Retrieves an expanded schema that has had all of its conditions, additional properties, references and dependencies
32
32
  * resolved and merged into the `schema` given a `validator`, `rootSchema` and `rawFormData` that is used to do the
@@ -196,10 +196,7 @@ export function resolveSchema<T = any, S extends StrictRJSFSchema = RJSFSchema,
196
196
  )
197
197
  );
198
198
  const allPermutations = getAllPermutationsOfXxxOf<S>(allOfSchemaElements);
199
- return allPermutations.map((permutation) => ({
200
- ...schema,
201
- allOf: permutation,
202
- }));
199
+ return allPermutations.map((permutation) => ({ ...schema, allOf: permutation }));
203
200
  }
204
201
  // No $ref or dependencies or allOf attribute was found, returning the original schema.
205
202
  return [schema];
@@ -296,7 +293,7 @@ export function resolveAllReferences<S extends StrictRJSFSchema = RJSFSchema>(
296
293
  };
297
294
  }
298
295
 
299
- return deepEquals(schema, resolvedSchema) ? schema : resolvedSchema;
296
+ return isEqual(schema, resolvedSchema) ? schema : resolvedSchema;
300
297
  }
301
298
 
302
299
  /** Creates new 'properties' items for each key in the `formData`
@@ -1,11 +1,11 @@
1
1
  import get from 'lodash/get';
2
+ import isEqual from 'lodash/isEqual';
2
3
 
3
4
  import { ALL_OF_KEY, DEPENDENCIES_KEY, ID_KEY, ITEMS_KEY, PROPERTIES_KEY, REF_KEY } from '../constants';
4
5
  import isObject from '../isObject';
5
6
  import { FormContextType, GenericObjectType, IdSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
6
7
  import retrieveSchema from './retrieveSchema';
7
8
  import getSchemaType from '../getSchemaType';
8
- import deepEquals from '../deepEquals';
9
9
 
10
10
  /** An internal helper that generates an `IdSchema` object for the `schema`, recursively with protection against
11
11
  * infinite recursion
@@ -32,7 +32,7 @@ function toIdSchemaInternal<T = any, S extends StrictRJSFSchema = RJSFSchema, F
32
32
  ): IdSchema<T> {
33
33
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
34
34
  const _schema = retrieveSchema<T, S, F>(validator, schema, rootSchema, formData);
35
- const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals(item, _schema));
35
+ const sameSchemaIndex = _recurseList.findIndex((item) => isEqual(item, _schema));
36
36
  if (sameSchemaIndex === -1) {
37
37
  return toIdSchemaInternal<T, S, F>(
38
38
  validator,
@@ -1,10 +1,11 @@
1
1
  import get from 'lodash/get';
2
+ import isEqual from 'lodash/isEqual';
2
3
  import set from 'lodash/set';
3
4
 
4
5
  import {
5
- ADDITIONAL_PROPERTIES_KEY,
6
6
  ALL_OF_KEY,
7
7
  ANY_OF_KEY,
8
+ ADDITIONAL_PROPERTIES_KEY,
8
9
  DEPENDENCIES_KEY,
9
10
  ITEMS_KEY,
10
11
  NAME_KEY,
@@ -17,7 +18,6 @@ import getDiscriminatorFieldFromSchema from '../getDiscriminatorFieldFromSchema'
17
18
  import { FormContextType, GenericObjectType, PathSchema, RJSFSchema, StrictRJSFSchema, ValidatorType } from '../types';
18
19
  import getClosestMatchingOption from './getClosestMatchingOption';
19
20
  import retrieveSchema from './retrieveSchema';
20
- import deepEquals from '../deepEquals';
21
21
 
22
22
  /** An internal helper that generates an `PathSchema` object for the `schema`, recursively with protection against
23
23
  * infinite recursion
@@ -40,7 +40,7 @@ function toPathSchemaInternal<T = any, S extends StrictRJSFSchema = RJSFSchema,
40
40
  ): PathSchema<T> {
41
41
  if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
42
42
  const _schema = retrieveSchema<T, S, F>(validator, schema, rootSchema, formData);
43
- const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals(item, _schema));
43
+ const sameSchemaIndex = _recurseList.findIndex((item) => isEqual(item, _schema));
44
44
  if (sameSchemaIndex === -1) {
45
45
  return toPathSchemaInternal<T, S, F>(
46
46
  validator,