@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/index.js
CHANGED
|
@@ -717,9 +717,24 @@ function retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, expa
|
|
|
717
717
|
return [...allOf, restOfSchema];
|
|
718
718
|
}
|
|
719
719
|
try {
|
|
720
|
+
const withContainsSchemas = [];
|
|
721
|
+
const withoutContainsSchemas = [];
|
|
722
|
+
resolvedSchema.allOf?.forEach((s2) => {
|
|
723
|
+
if (typeof s2 === "object" && s2.contains) {
|
|
724
|
+
withContainsSchemas.push(s2);
|
|
725
|
+
} else {
|
|
726
|
+
withoutContainsSchemas.push(s2);
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
if (withContainsSchemas.length) {
|
|
730
|
+
resolvedSchema = { ...resolvedSchema, allOf: withoutContainsSchemas };
|
|
731
|
+
}
|
|
720
732
|
resolvedSchema = (0, import_json_schema_merge_allof.default)(resolvedSchema, {
|
|
721
733
|
deep: false
|
|
722
734
|
});
|
|
735
|
+
if (withContainsSchemas.length) {
|
|
736
|
+
resolvedSchema.allOf = withContainsSchemas;
|
|
737
|
+
}
|
|
723
738
|
} catch (e) {
|
|
724
739
|
console.warn("could not merge subschemas in allOf:\n", e);
|
|
725
740
|
const { allOf, ...resolvedSchemaWithoutAllOf } = resolvedSchema;
|
|
@@ -2044,6 +2059,7 @@ function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
|
|
|
2044
2059
|
var import_cloneDeep = __toESM(require("lodash/cloneDeep"));
|
|
2045
2060
|
var import_get11 = __toESM(require("lodash/get"));
|
|
2046
2061
|
var import_set3 = __toESM(require("lodash/set"));
|
|
2062
|
+
var import_setWith = __toESM(require("lodash/setWith"));
|
|
2047
2063
|
var ErrorSchemaBuilder = class {
|
|
2048
2064
|
/** Construct an `ErrorSchemaBuilder` with an optional initial set of errors in an `ErrorSchema`.
|
|
2049
2065
|
*
|
|
@@ -2073,7 +2089,7 @@ var ErrorSchemaBuilder = class {
|
|
|
2073
2089
|
let errorBlock = hasPath ? (0, import_get11.default)(this.errorSchema, pathOfError) : this.errorSchema;
|
|
2074
2090
|
if (!errorBlock && pathOfError) {
|
|
2075
2091
|
errorBlock = {};
|
|
2076
|
-
(0,
|
|
2092
|
+
(0, import_setWith.default)(this.errorSchema, pathOfError, errorBlock, Object);
|
|
2077
2093
|
}
|
|
2078
2094
|
return errorBlock;
|
|
2079
2095
|
}
|