@rjsf/utils 6.1.1 → 6.2.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/index.cjs +241 -163
- package/dist/index.cjs.map +4 -4
- package/dist/utils.esm.js +241 -163
- package/dist/utils.esm.js.map +4 -4
- package/dist/utils.umd.js +258 -184
- package/lib/createSchemaUtils.js +13 -1
- package/lib/createSchemaUtils.js.map +1 -1
- package/lib/enums.d.ts +2 -0
- package/lib/enums.js +2 -0
- package/lib/enums.js.map +1 -1
- package/lib/schema/getDefaultFormState.js +21 -8
- package/lib/schema/getDefaultFormState.js.map +1 -1
- package/lib/schema/index.d.ts +4 -1
- package/lib/schema/index.js +4 -1
- package/lib/schema/index.js.map +1 -1
- package/lib/schema/omitExtraData.d.ts +26 -0
- package/lib/schema/omitExtraData.js +79 -0
- package/lib/schema/omitExtraData.js.map +1 -0
- package/lib/schema/retrieveSchema.js +19 -8
- package/lib/schema/retrieveSchema.js.map +1 -1
- package/lib/schema/toPathSchema.js +2 -2
- package/lib/schema/toPathSchema.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types.d.ts +19 -2
- package/package.json +2 -3
- package/src/createSchemaUtils.ts +13 -0
- package/src/enums.ts +2 -0
- package/src/schema/getDefaultFormState.ts +26 -10
- package/src/schema/index.ts +4 -0
- package/src/schema/omitExtraData.ts +93 -0
- package/src/schema/retrieveSchema.ts +22 -8
- package/src/schema/toPathSchema.ts +2 -1
- package/src/types.ts +19 -1
package/dist/index.cjs
CHANGED
|
@@ -99,6 +99,7 @@ __export(index_exports, {
|
|
|
99
99
|
getDefaultFormState: () => getDefaultFormState,
|
|
100
100
|
getDiscriminatorFieldFromSchema: () => getDiscriminatorFieldFromSchema,
|
|
101
101
|
getDisplayLabel: () => getDisplayLabel,
|
|
102
|
+
getFieldNames: () => getFieldNames,
|
|
102
103
|
getFirstMatchingOption: () => getFirstMatchingOption,
|
|
103
104
|
getFromSchema: () => getFromSchema,
|
|
104
105
|
getInputProps: () => getInputProps,
|
|
@@ -108,6 +109,7 @@ __export(index_exports, {
|
|
|
108
109
|
getTemplate: () => getTemplate,
|
|
109
110
|
getTestIds: () => getTestIds,
|
|
110
111
|
getUiOptions: () => getUiOptions,
|
|
112
|
+
getUsedFormData: () => getUsedFormData,
|
|
111
113
|
getWidget: () => getWidget,
|
|
112
114
|
guessType: () => guessType,
|
|
113
115
|
hasWidget: () => hasWidget,
|
|
@@ -130,6 +132,7 @@ __export(index_exports, {
|
|
|
130
132
|
mergeDefaultsWithFormData: () => mergeDefaultsWithFormData,
|
|
131
133
|
mergeObjects: () => mergeObjects,
|
|
132
134
|
mergeSchemas: () => mergeSchemas,
|
|
135
|
+
omitExtraData: () => omitExtraData,
|
|
133
136
|
optionId: () => optionId,
|
|
134
137
|
optionalControlsId: () => optionalControlsId,
|
|
135
138
|
optionsList: () => optionsList,
|
|
@@ -334,7 +337,9 @@ var import_transform = __toESM(require("lodash/transform"), 1);
|
|
|
334
337
|
var import_merge = __toESM(require("lodash/merge"), 1);
|
|
335
338
|
var import_flattenDeep = __toESM(require("lodash/flattenDeep"), 1);
|
|
336
339
|
var import_uniq = __toESM(require("lodash/uniq"), 1);
|
|
337
|
-
var
|
|
340
|
+
var import_isEmpty2 = __toESM(require("lodash/isEmpty"), 1);
|
|
341
|
+
var import_json_schema_merge = require("@x0k/json-schema-merge");
|
|
342
|
+
var import_array = require("@x0k/json-schema-merge/lib/array");
|
|
338
343
|
|
|
339
344
|
// src/findSchemaDefinition.ts
|
|
340
345
|
var import_jsonpointer = __toESM(require("jsonpointer"), 1);
|
|
@@ -599,7 +604,6 @@ function getFirstMatchingOption(validator, formData, options, rootSchema, discri
|
|
|
599
604
|
}
|
|
600
605
|
|
|
601
606
|
// src/schema/retrieveSchema.ts
|
|
602
|
-
var import_isEmpty2 = __toESM(require("lodash/isEmpty"), 1);
|
|
603
607
|
function retrieveSchema(validator, schema, rootSchema = {}, rawFormData, experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs = false) {
|
|
604
608
|
return retrieveSchemaInternal(
|
|
605
609
|
validator,
|
|
@@ -885,6 +889,15 @@ function stubExistingAdditionalProperties(validator, theSchema, rootSchema, aFor
|
|
|
885
889
|
});
|
|
886
890
|
return schema;
|
|
887
891
|
}
|
|
892
|
+
var { compareSchemaDefinitions, compareSchemaValues } = (0, import_json_schema_merge.createComparator)();
|
|
893
|
+
var { mergeArrayOfSchemaDefinitions } = (0, import_json_schema_merge.createMerger)({
|
|
894
|
+
intersectJson: (0, import_array.createIntersector)(compareSchemaValues),
|
|
895
|
+
deduplicateJsonSchemaDef: (0, import_array.createDeduplicator)(compareSchemaDefinitions)
|
|
896
|
+
});
|
|
897
|
+
var shallowAllOfMerge = (0, import_json_schema_merge.createShallowAllOfMerge)(mergeArrayOfSchemaDefinitions);
|
|
898
|
+
function mergeAllOf(schema) {
|
|
899
|
+
return shallowAllOfMerge(schema);
|
|
900
|
+
}
|
|
888
901
|
function retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, expandAllBranches = false, recurseList = [], experimental_customMergeAllOf, resolveAnyOfOrOneOfRefs) {
|
|
889
902
|
if (!isObject(schema)) {
|
|
890
903
|
return [{}];
|
|
@@ -930,12 +943,7 @@ function retrieveSchemaInternal(validator, schema, rootSchema, rawFormData, expa
|
|
|
930
943
|
if (withContainsSchemas.length) {
|
|
931
944
|
resolvedSchema = { ...resolvedSchema, allOf: withoutContainsSchemas };
|
|
932
945
|
}
|
|
933
|
-
resolvedSchema = experimental_customMergeAllOf ? experimental_customMergeAllOf(resolvedSchema) : (
|
|
934
|
-
deep: false,
|
|
935
|
-
resolvers: {
|
|
936
|
-
$defs: import_json_schema_merge_allof.default.options.resolvers.definitions
|
|
937
|
-
}
|
|
938
|
-
});
|
|
946
|
+
resolvedSchema = experimental_customMergeAllOf ? experimental_customMergeAllOf(resolvedSchema) : mergeAllOf(resolvedSchema);
|
|
939
947
|
if (withContainsSchemas.length) {
|
|
940
948
|
resolvedSchema.allOf = withContainsSchemas;
|
|
941
949
|
}
|
|
@@ -1679,7 +1687,7 @@ function computeDefaults(validator, rawSchema, computeDefaultsProps = {}) {
|
|
|
1679
1687
|
let updatedRecurseList = _recurseList;
|
|
1680
1688
|
if (schema[CONST_KEY] !== void 0 && experimental_defaultFormStateBehavior?.constAsDefaults !== "never" && !constIsAjvDataReference(schema)) {
|
|
1681
1689
|
defaults = schema[CONST_KEY];
|
|
1682
|
-
} else if (isObject(defaults) && isObject(schema.default)) {
|
|
1690
|
+
} else if (isObject(defaults) && isObject(schema.default) && !schema[ANY_OF_KEY] && !schema[ONE_OF_KEY] && !schema[REF_KEY]) {
|
|
1683
1691
|
defaults = mergeObjects(defaults, schema.default);
|
|
1684
1692
|
} else if (DEFAULT_KEY in schema && !schema[ANY_OF_KEY] && !schema[ONE_OF_KEY] && !schema[REF_KEY]) {
|
|
1685
1693
|
defaults = schema.default;
|
|
@@ -1689,7 +1697,8 @@ function computeDefaults(validator, rawSchema, computeDefaultsProps = {}) {
|
|
|
1689
1697
|
updatedRecurseList = _recurseList.concat(refName);
|
|
1690
1698
|
schemaToCompute = findSchemaDefinition(refName, rootSchema);
|
|
1691
1699
|
}
|
|
1692
|
-
|
|
1700
|
+
const hasNoExistingData = rawFormData === void 0 || isObject(rawFormData) && (0, import_isEmpty4.default)(rawFormData);
|
|
1701
|
+
if (schemaToCompute && !defaults && hasNoExistingData) {
|
|
1693
1702
|
defaults = schema.default;
|
|
1694
1703
|
}
|
|
1695
1704
|
if (shouldMergeDefaultsIntoFormData && schemaToCompute && !isObject(rawFormData)) {
|
|
@@ -1833,7 +1842,8 @@ function getObjectDefaults(validator, rawSchema, {
|
|
|
1833
1842
|
{
|
|
1834
1843
|
const formData = isObject(rawFormData) ? rawFormData : {};
|
|
1835
1844
|
const schema = rawSchema;
|
|
1836
|
-
const
|
|
1845
|
+
const shouldRetrieveSchema = experimental_defaultFormStateBehavior?.allOf === "populateDefaults" && ALL_OF_KEY in schema || experimental_defaultFormStateBehavior?.emptyObjectFields !== "skipEmptyDefaults" && IF_KEY in schema;
|
|
1846
|
+
const retrievedSchema = shouldRetrieveSchema ? retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf) : schema;
|
|
1837
1847
|
const parentConst = retrievedSchema[CONST_KEY];
|
|
1838
1848
|
const objectDefaults = Object.keys(retrievedSchema.properties || {}).reduce(
|
|
1839
1849
|
(acc, key) => {
|
|
@@ -1927,12 +1937,14 @@ function getArrayDefaults(validator, rawSchema, {
|
|
|
1927
1937
|
if (Array.isArray(defaults)) {
|
|
1928
1938
|
defaults = defaults.map((item, idx) => {
|
|
1929
1939
|
const schemaItem = getInnerSchemaForArrayItem(schema, 2 /* Fallback */, idx);
|
|
1940
|
+
const itemFormData = Array.isArray(rawFormData) ? rawFormData[idx] : void 0;
|
|
1930
1941
|
return computeDefaults(validator, schemaItem, {
|
|
1931
1942
|
rootSchema,
|
|
1932
1943
|
_recurseList,
|
|
1933
1944
|
experimental_defaultFormStateBehavior,
|
|
1934
1945
|
experimental_customMergeAllOf,
|
|
1935
1946
|
parentDefaults: item,
|
|
1947
|
+
rawFormData: itemFormData,
|
|
1936
1948
|
required,
|
|
1937
1949
|
shouldMergeDefaultsIntoFormData,
|
|
1938
1950
|
initialDefaultsGenerated
|
|
@@ -2097,8 +2109,175 @@ function getDisplayLabel(validator, schema, uiSchema = {}, rootSchema, globalOpt
|
|
|
2097
2109
|
return displayLabel;
|
|
2098
2110
|
}
|
|
2099
2111
|
|
|
2100
|
-
// src/schema/
|
|
2112
|
+
// src/schema/omitExtraData.ts
|
|
2113
|
+
var import_pick = __toESM(require("lodash/pick"), 1);
|
|
2114
|
+
var import_isEmpty5 = __toESM(require("lodash/isEmpty"), 1);
|
|
2115
|
+
var import_get15 = __toESM(require("lodash/get"), 1);
|
|
2116
|
+
|
|
2117
|
+
// src/schema/toPathSchema.ts
|
|
2101
2118
|
var import_get14 = __toESM(require("lodash/get"), 1);
|
|
2119
|
+
var import_set2 = __toESM(require("lodash/set"), 1);
|
|
2120
|
+
function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
|
|
2121
|
+
if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema || IF_KEY in schema) {
|
|
2122
|
+
const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
|
|
2123
|
+
const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals(item, _schema));
|
|
2124
|
+
if (sameSchemaIndex === -1) {
|
|
2125
|
+
return toPathSchemaInternal(
|
|
2126
|
+
validator,
|
|
2127
|
+
_schema,
|
|
2128
|
+
name,
|
|
2129
|
+
rootSchema,
|
|
2130
|
+
formData,
|
|
2131
|
+
_recurseList.concat(_schema),
|
|
2132
|
+
experimental_customMergeAllOf
|
|
2133
|
+
);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
let pathSchema = {
|
|
2137
|
+
[NAME_KEY]: name.replace(/^\./, "")
|
|
2138
|
+
};
|
|
2139
|
+
if (ONE_OF_KEY in schema || ANY_OF_KEY in schema) {
|
|
2140
|
+
const xxxOf = ONE_OF_KEY in schema ? schema.oneOf : schema.anyOf;
|
|
2141
|
+
const discriminator = getDiscriminatorFieldFromSchema(schema);
|
|
2142
|
+
const index = getClosestMatchingOption(
|
|
2143
|
+
validator,
|
|
2144
|
+
rootSchema,
|
|
2145
|
+
formData,
|
|
2146
|
+
xxxOf,
|
|
2147
|
+
0,
|
|
2148
|
+
discriminator,
|
|
2149
|
+
experimental_customMergeAllOf
|
|
2150
|
+
);
|
|
2151
|
+
const _schema = xxxOf[index];
|
|
2152
|
+
pathSchema = {
|
|
2153
|
+
...pathSchema,
|
|
2154
|
+
...toPathSchemaInternal(
|
|
2155
|
+
validator,
|
|
2156
|
+
_schema,
|
|
2157
|
+
name,
|
|
2158
|
+
rootSchema,
|
|
2159
|
+
formData,
|
|
2160
|
+
_recurseList,
|
|
2161
|
+
experimental_customMergeAllOf
|
|
2162
|
+
)
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2165
|
+
if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
|
|
2166
|
+
(0, import_set2.default)(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
|
|
2167
|
+
}
|
|
2168
|
+
if (ITEMS_KEY in schema && Array.isArray(formData)) {
|
|
2169
|
+
const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
|
|
2170
|
+
if (Array.isArray(schemaItems)) {
|
|
2171
|
+
formData.forEach((element, i) => {
|
|
2172
|
+
if (schemaItems[i]) {
|
|
2173
|
+
pathSchema[i] = toPathSchemaInternal(
|
|
2174
|
+
validator,
|
|
2175
|
+
schemaItems[i],
|
|
2176
|
+
`${name}.${i}`,
|
|
2177
|
+
rootSchema,
|
|
2178
|
+
element,
|
|
2179
|
+
_recurseList,
|
|
2180
|
+
experimental_customMergeAllOf
|
|
2181
|
+
);
|
|
2182
|
+
} else if (schemaAdditionalItems) {
|
|
2183
|
+
pathSchema[i] = toPathSchemaInternal(
|
|
2184
|
+
validator,
|
|
2185
|
+
schemaAdditionalItems,
|
|
2186
|
+
`${name}.${i}`,
|
|
2187
|
+
rootSchema,
|
|
2188
|
+
element,
|
|
2189
|
+
_recurseList,
|
|
2190
|
+
experimental_customMergeAllOf
|
|
2191
|
+
);
|
|
2192
|
+
} else {
|
|
2193
|
+
console.warn(`Unable to generate path schema for "${name}.${i}". No schema defined for it`);
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2196
|
+
} else {
|
|
2197
|
+
formData.forEach((element, i) => {
|
|
2198
|
+
pathSchema[i] = toPathSchemaInternal(
|
|
2199
|
+
validator,
|
|
2200
|
+
schemaItems,
|
|
2201
|
+
`${name}.${i}`,
|
|
2202
|
+
rootSchema,
|
|
2203
|
+
element,
|
|
2204
|
+
_recurseList,
|
|
2205
|
+
experimental_customMergeAllOf
|
|
2206
|
+
);
|
|
2207
|
+
});
|
|
2208
|
+
}
|
|
2209
|
+
} else if (PROPERTIES_KEY in schema) {
|
|
2210
|
+
for (const property in schema.properties) {
|
|
2211
|
+
const field = (0, import_get14.default)(schema, [PROPERTIES_KEY, property], {});
|
|
2212
|
+
pathSchema[property] = toPathSchemaInternal(
|
|
2213
|
+
validator,
|
|
2214
|
+
field,
|
|
2215
|
+
`${name}.${property}`,
|
|
2216
|
+
rootSchema,
|
|
2217
|
+
// It's possible that formData is not an object -- this can happen if an
|
|
2218
|
+
// array item has just been added, but not populated with data yet
|
|
2219
|
+
(0, import_get14.default)(formData, [property]),
|
|
2220
|
+
_recurseList,
|
|
2221
|
+
experimental_customMergeAllOf
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
return pathSchema;
|
|
2226
|
+
}
|
|
2227
|
+
function toPathSchema(validator, schema, name = "", rootSchema, formData, experimental_customMergeAllOf) {
|
|
2228
|
+
return toPathSchemaInternal(validator, schema, name, rootSchema, formData, void 0, experimental_customMergeAllOf);
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
// src/schema/omitExtraData.ts
|
|
2232
|
+
function getUsedFormData(formData, fields) {
|
|
2233
|
+
if (fields.length === 0 && typeof formData !== "object") {
|
|
2234
|
+
return formData;
|
|
2235
|
+
}
|
|
2236
|
+
const data = (0, import_pick.default)(formData, fields);
|
|
2237
|
+
if (Array.isArray(formData)) {
|
|
2238
|
+
return Object.keys(data).map((key) => data[key]);
|
|
2239
|
+
}
|
|
2240
|
+
return data;
|
|
2241
|
+
}
|
|
2242
|
+
function getFieldNames(pathSchema, formData) {
|
|
2243
|
+
const formValueHasData = (value, isLeaf) => typeof value !== "object" || (0, import_isEmpty5.default)(value) || isLeaf && !(0, import_isEmpty5.default)(value);
|
|
2244
|
+
const getAllPaths = (_obj, acc = [], paths = [[]]) => {
|
|
2245
|
+
const objKeys = Object.keys(_obj);
|
|
2246
|
+
objKeys.forEach((key) => {
|
|
2247
|
+
const data = _obj[key];
|
|
2248
|
+
if (typeof data === "object") {
|
|
2249
|
+
const newPaths = paths.map((path) => [...path, key]);
|
|
2250
|
+
if (data[RJSF_ADDITIONAL_PROPERTIES_FLAG] && data[NAME_KEY] !== "") {
|
|
2251
|
+
acc.push(data[NAME_KEY]);
|
|
2252
|
+
} else {
|
|
2253
|
+
getAllPaths(data, acc, newPaths);
|
|
2254
|
+
}
|
|
2255
|
+
} else if (key === NAME_KEY && data !== "") {
|
|
2256
|
+
paths.forEach((path) => {
|
|
2257
|
+
const formValue = (0, import_get15.default)(formData, path);
|
|
2258
|
+
const isLeaf = objKeys.length === 1;
|
|
2259
|
+
if (formValueHasData(formValue, isLeaf) || Array.isArray(formValue) && formValue.every((val) => formValueHasData(val, isLeaf))) {
|
|
2260
|
+
acc.push(path);
|
|
2261
|
+
}
|
|
2262
|
+
});
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
return acc;
|
|
2266
|
+
};
|
|
2267
|
+
return getAllPaths(pathSchema);
|
|
2268
|
+
}
|
|
2269
|
+
function omitExtraData(validator, schema, rootSchema = {}, formData) {
|
|
2270
|
+
const retrievedSchema = retrieveSchema(validator, schema, rootSchema, formData);
|
|
2271
|
+
const pathSchema = toPathSchema(validator, retrievedSchema, "", rootSchema, formData);
|
|
2272
|
+
const fieldNames = getFieldNames(pathSchema, formData);
|
|
2273
|
+
const lodashFieldNames = fieldNames.map(
|
|
2274
|
+
(fieldPaths) => Array.isArray(fieldPaths) ? fieldPaths.join(".") : fieldPaths
|
|
2275
|
+
);
|
|
2276
|
+
return getUsedFormData(formData, lodashFieldNames);
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
// src/schema/sanitizeDataForNewSchema.ts
|
|
2280
|
+
var import_get16 = __toESM(require("lodash/get"), 1);
|
|
2102
2281
|
var import_has5 = __toESM(require("lodash/has"), 1);
|
|
2103
2282
|
var NO_VALUE = Symbol("no Value");
|
|
2104
2283
|
function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, data = {}, experimental_customMergeAllOf) {
|
|
@@ -2106,19 +2285,19 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2106
2285
|
if ((0, import_has5.default)(newSchema, PROPERTIES_KEY)) {
|
|
2107
2286
|
const removeOldSchemaData = {};
|
|
2108
2287
|
if ((0, import_has5.default)(oldSchema, PROPERTIES_KEY)) {
|
|
2109
|
-
const properties = (0,
|
|
2288
|
+
const properties = (0, import_get16.default)(oldSchema, PROPERTIES_KEY, {});
|
|
2110
2289
|
Object.keys(properties).forEach((key) => {
|
|
2111
2290
|
if ((0, import_has5.default)(data, key)) {
|
|
2112
2291
|
removeOldSchemaData[key] = void 0;
|
|
2113
2292
|
}
|
|
2114
2293
|
});
|
|
2115
2294
|
}
|
|
2116
|
-
const keys2 = Object.keys((0,
|
|
2295
|
+
const keys2 = Object.keys((0, import_get16.default)(newSchema, PROPERTIES_KEY, {}));
|
|
2117
2296
|
const nestedData = {};
|
|
2118
2297
|
keys2.forEach((key) => {
|
|
2119
|
-
const formValue = (0,
|
|
2120
|
-
let oldKeyedSchema = (0,
|
|
2121
|
-
let newKeyedSchema = (0,
|
|
2298
|
+
const formValue = (0, import_get16.default)(data, key);
|
|
2299
|
+
let oldKeyedSchema = (0, import_get16.default)(oldSchema, [PROPERTIES_KEY, key], {});
|
|
2300
|
+
let newKeyedSchema = (0, import_get16.default)(newSchema, [PROPERTIES_KEY, key], {});
|
|
2122
2301
|
if ((0, import_has5.default)(oldKeyedSchema, REF_KEY)) {
|
|
2123
2302
|
oldKeyedSchema = retrieveSchema(
|
|
2124
2303
|
validator,
|
|
@@ -2137,8 +2316,8 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2137
2316
|
experimental_customMergeAllOf
|
|
2138
2317
|
);
|
|
2139
2318
|
}
|
|
2140
|
-
const oldSchemaTypeForKey = (0,
|
|
2141
|
-
const newSchemaTypeForKey = (0,
|
|
2319
|
+
const oldSchemaTypeForKey = (0, import_get16.default)(oldKeyedSchema, "type");
|
|
2320
|
+
const newSchemaTypeForKey = (0, import_get16.default)(newKeyedSchema, "type");
|
|
2142
2321
|
if (!oldSchemaTypeForKey || oldSchemaTypeForKey === newSchemaTypeForKey) {
|
|
2143
2322
|
if ((0, import_has5.default)(removeOldSchemaData, key)) {
|
|
2144
2323
|
delete removeOldSchemaData[key];
|
|
@@ -2156,17 +2335,17 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2156
2335
|
nestedData[key] = itemData;
|
|
2157
2336
|
}
|
|
2158
2337
|
} else {
|
|
2159
|
-
const newOptionDefault = (0,
|
|
2160
|
-
const oldOptionDefault = (0,
|
|
2338
|
+
const newOptionDefault = (0, import_get16.default)(newKeyedSchema, "default", NO_VALUE);
|
|
2339
|
+
const oldOptionDefault = (0, import_get16.default)(oldKeyedSchema, "default", NO_VALUE);
|
|
2161
2340
|
if (newOptionDefault !== NO_VALUE && newOptionDefault !== formValue) {
|
|
2162
2341
|
if (oldOptionDefault === formValue) {
|
|
2163
2342
|
removeOldSchemaData[key] = newOptionDefault;
|
|
2164
|
-
} else if ((0,
|
|
2343
|
+
} else if ((0, import_get16.default)(newKeyedSchema, "readOnly") === true) {
|
|
2165
2344
|
removeOldSchemaData[key] = void 0;
|
|
2166
2345
|
}
|
|
2167
2346
|
}
|
|
2168
|
-
const newOptionConst = (0,
|
|
2169
|
-
const oldOptionConst = (0,
|
|
2347
|
+
const newOptionConst = (0, import_get16.default)(newKeyedSchema, "const", NO_VALUE);
|
|
2348
|
+
const oldOptionConst = (0, import_get16.default)(oldKeyedSchema, "const", NO_VALUE);
|
|
2170
2349
|
if (newOptionConst !== NO_VALUE && newOptionConst !== formValue) {
|
|
2171
2350
|
removeOldSchemaData[key] = oldOptionConst === formValue ? newOptionConst : void 0;
|
|
2172
2351
|
}
|
|
@@ -2178,9 +2357,9 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2178
2357
|
...removeOldSchemaData,
|
|
2179
2358
|
...nestedData
|
|
2180
2359
|
};
|
|
2181
|
-
} else if ((0,
|
|
2182
|
-
let oldSchemaItems = (0,
|
|
2183
|
-
let newSchemaItems = (0,
|
|
2360
|
+
} else if ((0, import_get16.default)(oldSchema, "type") === "array" && (0, import_get16.default)(newSchema, "type") === "array" && Array.isArray(data)) {
|
|
2361
|
+
let oldSchemaItems = (0, import_get16.default)(oldSchema, "items");
|
|
2362
|
+
let newSchemaItems = (0, import_get16.default)(newSchema, "items");
|
|
2184
2363
|
if (typeof oldSchemaItems === "object" && typeof newSchemaItems === "object" && !Array.isArray(oldSchemaItems) && !Array.isArray(newSchemaItems)) {
|
|
2185
2364
|
if ((0, import_has5.default)(oldSchemaItems, REF_KEY)) {
|
|
2186
2365
|
oldSchemaItems = retrieveSchema(
|
|
@@ -2200,10 +2379,10 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2200
2379
|
experimental_customMergeAllOf
|
|
2201
2380
|
);
|
|
2202
2381
|
}
|
|
2203
|
-
const oldSchemaType = (0,
|
|
2204
|
-
const newSchemaType = (0,
|
|
2382
|
+
const oldSchemaType = (0, import_get16.default)(oldSchemaItems, "type");
|
|
2383
|
+
const newSchemaType = (0, import_get16.default)(newSchemaItems, "type");
|
|
2205
2384
|
if (!oldSchemaType || oldSchemaType === newSchemaType) {
|
|
2206
|
-
const maxItems = (0,
|
|
2385
|
+
const maxItems = (0, import_get16.default)(newSchema, "maxItems", -1);
|
|
2207
2386
|
if (newSchemaType === "object") {
|
|
2208
2387
|
newFormData = data.reduce((newValue, aValue) => {
|
|
2209
2388
|
const itemValue = sanitizeDataForNewSchema(
|
|
@@ -2230,122 +2409,8 @@ function sanitizeDataForNewSchema(validator, rootSchema, newSchema, oldSchema, d
|
|
|
2230
2409
|
return newFormData;
|
|
2231
2410
|
}
|
|
2232
2411
|
|
|
2233
|
-
// src/schema/toPathSchema.ts
|
|
2234
|
-
var import_get15 = __toESM(require("lodash/get"), 1);
|
|
2235
|
-
var import_set2 = __toESM(require("lodash/set"), 1);
|
|
2236
|
-
function toPathSchemaInternal(validator, schema, name, rootSchema, formData, _recurseList = [], experimental_customMergeAllOf) {
|
|
2237
|
-
if (REF_KEY in schema || DEPENDENCIES_KEY in schema || ALL_OF_KEY in schema) {
|
|
2238
|
-
const _schema = retrieveSchema(validator, schema, rootSchema, formData, experimental_customMergeAllOf);
|
|
2239
|
-
const sameSchemaIndex = _recurseList.findIndex((item) => deepEquals(item, _schema));
|
|
2240
|
-
if (sameSchemaIndex === -1) {
|
|
2241
|
-
return toPathSchemaInternal(
|
|
2242
|
-
validator,
|
|
2243
|
-
_schema,
|
|
2244
|
-
name,
|
|
2245
|
-
rootSchema,
|
|
2246
|
-
formData,
|
|
2247
|
-
_recurseList.concat(_schema),
|
|
2248
|
-
experimental_customMergeAllOf
|
|
2249
|
-
);
|
|
2250
|
-
}
|
|
2251
|
-
}
|
|
2252
|
-
let pathSchema = {
|
|
2253
|
-
[NAME_KEY]: name.replace(/^\./, "")
|
|
2254
|
-
};
|
|
2255
|
-
if (ONE_OF_KEY in schema || ANY_OF_KEY in schema) {
|
|
2256
|
-
const xxxOf = ONE_OF_KEY in schema ? schema.oneOf : schema.anyOf;
|
|
2257
|
-
const discriminator = getDiscriminatorFieldFromSchema(schema);
|
|
2258
|
-
const index = getClosestMatchingOption(
|
|
2259
|
-
validator,
|
|
2260
|
-
rootSchema,
|
|
2261
|
-
formData,
|
|
2262
|
-
xxxOf,
|
|
2263
|
-
0,
|
|
2264
|
-
discriminator,
|
|
2265
|
-
experimental_customMergeAllOf
|
|
2266
|
-
);
|
|
2267
|
-
const _schema = xxxOf[index];
|
|
2268
|
-
pathSchema = {
|
|
2269
|
-
...pathSchema,
|
|
2270
|
-
...toPathSchemaInternal(
|
|
2271
|
-
validator,
|
|
2272
|
-
_schema,
|
|
2273
|
-
name,
|
|
2274
|
-
rootSchema,
|
|
2275
|
-
formData,
|
|
2276
|
-
_recurseList,
|
|
2277
|
-
experimental_customMergeAllOf
|
|
2278
|
-
)
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
if (ADDITIONAL_PROPERTIES_KEY in schema && schema[ADDITIONAL_PROPERTIES_KEY] !== false) {
|
|
2282
|
-
(0, import_set2.default)(pathSchema, RJSF_ADDITIONAL_PROPERTIES_FLAG, true);
|
|
2283
|
-
}
|
|
2284
|
-
if (ITEMS_KEY in schema && Array.isArray(formData)) {
|
|
2285
|
-
const { items: schemaItems, additionalItems: schemaAdditionalItems } = schema;
|
|
2286
|
-
if (Array.isArray(schemaItems)) {
|
|
2287
|
-
formData.forEach((element, i) => {
|
|
2288
|
-
if (schemaItems[i]) {
|
|
2289
|
-
pathSchema[i] = toPathSchemaInternal(
|
|
2290
|
-
validator,
|
|
2291
|
-
schemaItems[i],
|
|
2292
|
-
`${name}.${i}`,
|
|
2293
|
-
rootSchema,
|
|
2294
|
-
element,
|
|
2295
|
-
_recurseList,
|
|
2296
|
-
experimental_customMergeAllOf
|
|
2297
|
-
);
|
|
2298
|
-
} else if (schemaAdditionalItems) {
|
|
2299
|
-
pathSchema[i] = toPathSchemaInternal(
|
|
2300
|
-
validator,
|
|
2301
|
-
schemaAdditionalItems,
|
|
2302
|
-
`${name}.${i}`,
|
|
2303
|
-
rootSchema,
|
|
2304
|
-
element,
|
|
2305
|
-
_recurseList,
|
|
2306
|
-
experimental_customMergeAllOf
|
|
2307
|
-
);
|
|
2308
|
-
} else {
|
|
2309
|
-
console.warn(`Unable to generate path schema for "${name}.${i}". No schema defined for it`);
|
|
2310
|
-
}
|
|
2311
|
-
});
|
|
2312
|
-
} else {
|
|
2313
|
-
formData.forEach((element, i) => {
|
|
2314
|
-
pathSchema[i] = toPathSchemaInternal(
|
|
2315
|
-
validator,
|
|
2316
|
-
schemaItems,
|
|
2317
|
-
`${name}.${i}`,
|
|
2318
|
-
rootSchema,
|
|
2319
|
-
element,
|
|
2320
|
-
_recurseList,
|
|
2321
|
-
experimental_customMergeAllOf
|
|
2322
|
-
);
|
|
2323
|
-
});
|
|
2324
|
-
}
|
|
2325
|
-
} else if (PROPERTIES_KEY in schema) {
|
|
2326
|
-
for (const property in schema.properties) {
|
|
2327
|
-
const field = (0, import_get15.default)(schema, [PROPERTIES_KEY, property], {});
|
|
2328
|
-
pathSchema[property] = toPathSchemaInternal(
|
|
2329
|
-
validator,
|
|
2330
|
-
field,
|
|
2331
|
-
`${name}.${property}`,
|
|
2332
|
-
rootSchema,
|
|
2333
|
-
// It's possible that formData is not an object -- this can happen if an
|
|
2334
|
-
// array item has just been added, but not populated with data yet
|
|
2335
|
-
(0, import_get15.default)(formData, [property]),
|
|
2336
|
-
_recurseList,
|
|
2337
|
-
experimental_customMergeAllOf
|
|
2338
|
-
);
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
return pathSchema;
|
|
2342
|
-
}
|
|
2343
|
-
function toPathSchema(validator, schema, name = "", rootSchema, formData, experimental_customMergeAllOf) {
|
|
2344
|
-
return toPathSchemaInternal(validator, schema, name, rootSchema, formData, void 0, experimental_customMergeAllOf);
|
|
2345
|
-
}
|
|
2346
|
-
|
|
2347
2412
|
// src/createSchemaUtils.ts
|
|
2348
|
-
var
|
|
2413
|
+
var import_get17 = __toESM(require("lodash/get"), 1);
|
|
2349
2414
|
var SchemaUtils = class {
|
|
2350
2415
|
/** Constructs the `SchemaUtils` instance with the given `validator` and `rootSchema` stored as instance variables
|
|
2351
2416
|
*
|
|
@@ -2356,7 +2421,7 @@ var SchemaUtils = class {
|
|
|
2356
2421
|
*/
|
|
2357
2422
|
constructor(validator, rootSchema, experimental_defaultFormStateBehavior, experimental_customMergeAllOf) {
|
|
2358
2423
|
if (rootSchema && rootSchema[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
|
|
2359
|
-
this.rootSchema = makeAllReferencesAbsolute(rootSchema, (0,
|
|
2424
|
+
this.rootSchema = makeAllReferencesAbsolute(rootSchema, (0, import_get17.default)(rootSchema, ID_KEY, "#"));
|
|
2360
2425
|
} else {
|
|
2361
2426
|
this.rootSchema = rootSchema;
|
|
2362
2427
|
}
|
|
@@ -2548,6 +2613,18 @@ var SchemaUtils = class {
|
|
|
2548
2613
|
isSelect(schema) {
|
|
2549
2614
|
return isSelect(this.validator, schema, this.rootSchema, this.experimental_customMergeAllOf);
|
|
2550
2615
|
}
|
|
2616
|
+
/**
|
|
2617
|
+
* The function takes a `schema` and `formData` and returns a copy of the formData with any fields not defined in the schema removed.
|
|
2618
|
+
* This is useful for ensuring that only data that is relevant to the schema is preserved. Objects with `additionalProperties`
|
|
2619
|
+
* keyword set to `true` will not have their extra fields removed.
|
|
2620
|
+
*
|
|
2621
|
+
* @param schema - The schema to use for filtering the `formData`
|
|
2622
|
+
* @param [formData] - The formData to filter
|
|
2623
|
+
* @returns The new form data, with any fields not defined in the schema removed
|
|
2624
|
+
*/
|
|
2625
|
+
omitExtraData(schema, formData) {
|
|
2626
|
+
return omitExtraData(this.validator, schema, this.rootSchema, formData);
|
|
2627
|
+
}
|
|
2551
2628
|
/** Retrieves an expanded schema that has had all of its conditions, additional properties, references and
|
|
2552
2629
|
* dependencies resolved and merged into the `schema` given a `rawFormData` that is used to do the potentially
|
|
2553
2630
|
* recursive resolution.
|
|
@@ -2770,7 +2847,7 @@ function enumOptionsSelectValue(valueIndex, selected, allEnumOptions = []) {
|
|
|
2770
2847
|
|
|
2771
2848
|
// src/ErrorSchemaBuilder.ts
|
|
2772
2849
|
var import_cloneDeep = __toESM(require("lodash/cloneDeep"), 1);
|
|
2773
|
-
var
|
|
2850
|
+
var import_get18 = __toESM(require("lodash/get"), 1);
|
|
2774
2851
|
var import_set3 = __toESM(require("lodash/set"), 1);
|
|
2775
2852
|
var import_setWith = __toESM(require("lodash/setWith"), 1);
|
|
2776
2853
|
var ErrorSchemaBuilder = class {
|
|
@@ -2799,7 +2876,7 @@ var ErrorSchemaBuilder = class {
|
|
|
2799
2876
|
*/
|
|
2800
2877
|
getOrCreateErrorBlock(pathOfError) {
|
|
2801
2878
|
const hasPath = Array.isArray(pathOfError) && pathOfError.length > 0 || typeof pathOfError === "string";
|
|
2802
|
-
let errorBlock = hasPath ? (0,
|
|
2879
|
+
let errorBlock = hasPath ? (0, import_get18.default)(this.errorSchema, pathOfError) : this.errorSchema;
|
|
2803
2880
|
if (!errorBlock && pathOfError) {
|
|
2804
2881
|
errorBlock = {};
|
|
2805
2882
|
(0, import_setWith.default)(this.errorSchema, pathOfError, errorBlock, Object);
|
|
@@ -2825,7 +2902,7 @@ var ErrorSchemaBuilder = class {
|
|
|
2825
2902
|
*/
|
|
2826
2903
|
addErrors(errorOrList, pathOfError) {
|
|
2827
2904
|
const errorBlock = this.getOrCreateErrorBlock(pathOfError);
|
|
2828
|
-
let errorsList = (0,
|
|
2905
|
+
let errorsList = (0, import_get18.default)(errorBlock, ERRORS_KEY);
|
|
2829
2906
|
if (!Array.isArray(errorsList)) {
|
|
2830
2907
|
errorsList = [];
|
|
2831
2908
|
errorBlock[ERRORS_KEY] = errorsList;
|
|
@@ -2869,7 +2946,7 @@ var ErrorSchemaBuilder = class {
|
|
|
2869
2946
|
var import_keys = __toESM(require("lodash/keys"), 1);
|
|
2870
2947
|
var import_pickBy = __toESM(require("lodash/pickBy"), 1);
|
|
2871
2948
|
var import_isPlainObject2 = __toESM(require("lodash/isPlainObject"), 1);
|
|
2872
|
-
var
|
|
2949
|
+
var import_get19 = __toESM(require("lodash/get"), 1);
|
|
2873
2950
|
var import_difference = __toESM(require("lodash/difference"), 1);
|
|
2874
2951
|
function getChangedFields(a, b) {
|
|
2875
2952
|
const aIsPlainObject = (0, import_isPlainObject2.default)(a);
|
|
@@ -2882,7 +2959,7 @@ function getChangedFields(a, b) {
|
|
|
2882
2959
|
} else if (!aIsPlainObject && bIsPlainObject) {
|
|
2883
2960
|
return (0, import_keys.default)(b);
|
|
2884
2961
|
} else {
|
|
2885
|
-
const unequalFields = (0, import_keys.default)((0, import_pickBy.default)(a, (value, key) => !deepEquals(value, (0,
|
|
2962
|
+
const unequalFields = (0, import_keys.default)((0, import_pickBy.default)(a, (value, key) => !deepEquals(value, (0, import_get19.default)(b, key))));
|
|
2886
2963
|
const diffFields = (0, import_difference.default)((0, import_keys.default)(b), (0, import_keys.default)(a));
|
|
2887
2964
|
return [...unequalFields, ...diffFields];
|
|
2888
2965
|
}
|
|
@@ -2996,10 +3073,10 @@ function getTemplate(name, registry, uiOptions = {}) {
|
|
|
2996
3073
|
}
|
|
2997
3074
|
|
|
2998
3075
|
// src/getTestIds.ts
|
|
2999
|
-
var
|
|
3076
|
+
var import_get20 = __toESM(require("lodash/get"), 1);
|
|
3000
3077
|
var import_uniqueId = __toESM(require("lodash/uniqueId"), 1);
|
|
3001
3078
|
function getTestIds() {
|
|
3002
|
-
if (typeof process === "undefined" || (0,
|
|
3079
|
+
if (typeof process === "undefined" || (0, import_get20.default)(process, "env.NODE_ENV") !== "test") {
|
|
3003
3080
|
return {};
|
|
3004
3081
|
}
|
|
3005
3082
|
const ids = /* @__PURE__ */ new Map();
|
|
@@ -3019,7 +3096,7 @@ function getTestIds() {
|
|
|
3019
3096
|
// src/getWidget.tsx
|
|
3020
3097
|
var import_react = require("react");
|
|
3021
3098
|
var import_react_is = __toESM(require("react-is"), 1);
|
|
3022
|
-
var
|
|
3099
|
+
var import_get21 = __toESM(require("lodash/get"), 1);
|
|
3023
3100
|
var import_set4 = __toESM(require("lodash/set"), 1);
|
|
3024
3101
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
3025
3102
|
var widgetMap = {
|
|
@@ -3075,7 +3152,7 @@ var widgetMap = {
|
|
|
3075
3152
|
}
|
|
3076
3153
|
};
|
|
3077
3154
|
function mergeWidgetOptions(AWidget) {
|
|
3078
|
-
let MergedWidget = (0,
|
|
3155
|
+
let MergedWidget = (0, import_get21.default)(AWidget, "MergedWidget");
|
|
3079
3156
|
if (!MergedWidget) {
|
|
3080
3157
|
const defaultOptions = AWidget.defaultProps && AWidget.defaultProps.options || {};
|
|
3081
3158
|
MergedWidget = ({ options, ...props }) => {
|
|
@@ -3182,10 +3259,10 @@ function optionalControlsId(id, element) {
|
|
|
3182
3259
|
|
|
3183
3260
|
// src/isFormDataAvailable.ts
|
|
3184
3261
|
var import_isNil3 = __toESM(require("lodash/isNil"), 1);
|
|
3185
|
-
var
|
|
3262
|
+
var import_isEmpty6 = __toESM(require("lodash/isEmpty"), 1);
|
|
3186
3263
|
var import_isObject11 = __toESM(require("lodash/isObject"), 1);
|
|
3187
3264
|
function isFormDataAvailable(formData) {
|
|
3188
|
-
return !(0, import_isNil3.default)(formData) && (!(0, import_isObject11.default)(formData) || Array.isArray(formData) || !(0,
|
|
3265
|
+
return !(0, import_isNil3.default)(formData) && (!(0, import_isObject11.default)(formData) || Array.isArray(formData) || !(0, import_isEmpty6.default)(formData));
|
|
3189
3266
|
}
|
|
3190
3267
|
|
|
3191
3268
|
// src/isRootSchema.ts
|
|
@@ -3213,14 +3290,14 @@ function localToUTC(dateString) {
|
|
|
3213
3290
|
}
|
|
3214
3291
|
|
|
3215
3292
|
// src/lookupFromFormContext.ts
|
|
3216
|
-
var
|
|
3293
|
+
var import_get22 = __toESM(require("lodash/get"), 1);
|
|
3217
3294
|
var import_has6 = __toESM(require("lodash/has"), 1);
|
|
3218
3295
|
function lookupFromFormContext(regOrFc, toLookup, fallback) {
|
|
3219
3296
|
const lookupPath = [LOOKUP_MAP_NAME];
|
|
3220
3297
|
if ((0, import_has6.default)(regOrFc, FORM_CONTEXT_NAME)) {
|
|
3221
3298
|
lookupPath.unshift(FORM_CONTEXT_NAME);
|
|
3222
3299
|
}
|
|
3223
|
-
return (0,
|
|
3300
|
+
return (0, import_get22.default)(regOrFc, [...lookupPath, toLookup], fallback);
|
|
3224
3301
|
}
|
|
3225
3302
|
|
|
3226
3303
|
// src/orderProperties.ts
|
|
@@ -3644,7 +3721,7 @@ function utcToLocal(jsonDate) {
|
|
|
3644
3721
|
}
|
|
3645
3722
|
|
|
3646
3723
|
// src/validationDataMerge.ts
|
|
3647
|
-
var
|
|
3724
|
+
var import_isEmpty7 = __toESM(require("lodash/isEmpty"), 1);
|
|
3648
3725
|
function validationDataMerge(validationData, additionalErrorSchema, preventDuplicates = false) {
|
|
3649
3726
|
if (!additionalErrorSchema) {
|
|
3650
3727
|
return validationData;
|
|
@@ -3652,7 +3729,7 @@ function validationDataMerge(validationData, additionalErrorSchema, preventDupli
|
|
|
3652
3729
|
const { errors: oldErrors, errorSchema: oldErrorSchema } = validationData;
|
|
3653
3730
|
let errors = toErrorList(additionalErrorSchema);
|
|
3654
3731
|
let errorSchema = additionalErrorSchema;
|
|
3655
|
-
if (!(0,
|
|
3732
|
+
if (!(0, import_isEmpty7.default)(oldErrorSchema)) {
|
|
3656
3733
|
errorSchema = mergeObjects(
|
|
3657
3734
|
oldErrorSchema,
|
|
3658
3735
|
additionalErrorSchema,
|
|
@@ -3740,6 +3817,7 @@ var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
|
|
|
3740
3817
|
TranslatableString2["OptionalObjectEmptyMsg"] = "No data for optional field";
|
|
3741
3818
|
TranslatableString2["Type"] = "Type";
|
|
3742
3819
|
TranslatableString2["Value"] = "Value";
|
|
3820
|
+
TranslatableString2["ClearButton"] = "clear input";
|
|
3743
3821
|
TranslatableString2["UnknownFieldType"] = "Unknown field type %1";
|
|
3744
3822
|
TranslatableString2["OptionPrefix"] = "Option %1";
|
|
3745
3823
|
TranslatableString2["TitleOptionPrefix"] = "%1 option %2";
|
|
@@ -3757,7 +3835,7 @@ var TranslatableString = /* @__PURE__ */ ((TranslatableString2) => {
|
|
|
3757
3835
|
var import_forEach = __toESM(require("lodash/forEach"), 1);
|
|
3758
3836
|
|
|
3759
3837
|
// src/parser/ParserValidator.ts
|
|
3760
|
-
var
|
|
3838
|
+
var import_get23 = __toESM(require("lodash/get"), 1);
|
|
3761
3839
|
var ParserValidator = class {
|
|
3762
3840
|
/** Construct the ParserValidator for the given `rootSchema`. This `rootSchema` will be stashed in the `schemaMap`
|
|
3763
3841
|
* first.
|
|
@@ -3783,7 +3861,7 @@ var ParserValidator = class {
|
|
|
3783
3861
|
* @param hash - The hash value at which to map the schema
|
|
3784
3862
|
*/
|
|
3785
3863
|
addSchema(schema, hash) {
|
|
3786
|
-
const key = (0,
|
|
3864
|
+
const key = (0, import_get23.default)(schema, ID_KEY, hash);
|
|
3787
3865
|
const identifiedSchema = { ...schema, [ID_KEY]: key };
|
|
3788
3866
|
const existing = this.schemaMap[key];
|
|
3789
3867
|
if (!existing) {
|