@rjsf/utils 5.21.1 → 5.21.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/index.js +17 -1
- package/dist/index.js.map +3 -3
- package/dist/utils.esm.js +17 -1
- package/dist/utils.esm.js.map +2 -2
- package/dist/utils.umd.js +20 -5
- package/lib/ErrorSchemaBuilder.d.ts +3 -3
- package/lib/ErrorSchemaBuilder.js +2 -1
- package/lib/ErrorSchemaBuilder.js.map +1 -1
- package/lib/schema/retrieveSchema.js +17 -0
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/ErrorSchemaBuilder.ts +6 -5
- package/src/schema/retrieveSchema.ts +15 -0
package/dist/utils.esm.js
CHANGED
|
@@ -580,9 +580,24 @@ function retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, expa
|
|
|
580
580
|
return [...allOf, restOfSchema];
|
|
581
581
|
}
|
|
582
582
|
try {
|
|
583
|
+
const withContainsSchemas = [];
|
|
584
|
+
const withoutContainsSchemas = [];
|
|
585
|
+
resolvedSchema.allOf?.forEach((s2) => {
|
|
586
|
+
if (typeof s2 === "object" && s2.contains) {
|
|
587
|
+
withContainsSchemas.push(s2);
|
|
588
|
+
} else {
|
|
589
|
+
withoutContainsSchemas.push(s2);
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
if (withContainsSchemas.length) {
|
|
593
|
+
resolvedSchema = { ...resolvedSchema, allOf: withoutContainsSchemas };
|
|
594
|
+
}
|
|
583
595
|
resolvedSchema = mergeAllOf(resolvedSchema, {
|
|
584
596
|
deep: false
|
|
585
597
|
});
|
|
598
|
+
if (withContainsSchemas.length) {
|
|
599
|
+
resolvedSchema.allOf = withContainsSchemas;
|
|
600
|
+
}
|
|
586
601
|
} catch (e) {
|
|
587
602
|
console.warn("could not merge subschemas in allOf:\n", e);
|
|
588
603
|
const { allOf, ...resolvedSchemaWithoutAllOf } = resolvedSchema;
|
|
@@ -1907,6 +1922,7 @@ function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
|
|
|
1907
1922
|
import cloneDeep from "lodash/cloneDeep";
|
|
1908
1923
|
import get11 from "lodash/get";
|
|
1909
1924
|
import set3 from "lodash/set";
|
|
1925
|
+
import setWith from "lodash/setWith";
|
|
1910
1926
|
var ErrorSchemaBuilder = class {
|
|
1911
1927
|
/** Construct an `ErrorSchemaBuilder` with an optional initial set of errors in an `ErrorSchema`.
|
|
1912
1928
|
*
|
|
@@ -1936,7 +1952,7 @@ var ErrorSchemaBuilder = class {
|
|
|
1936
1952
|
let errorBlock = hasPath ? get11(this.errorSchema, pathOfError) : this.errorSchema;
|
|
1937
1953
|
if (!errorBlock && pathOfError) {
|
|
1938
1954
|
errorBlock = {};
|
|
1939
|
-
|
|
1955
|
+
setWith(this.errorSchema, pathOfError, errorBlock, Object);
|
|
1940
1956
|
}
|
|
1941
1957
|
return errorBlock;
|
|
1942
1958
|
}
|