Skip to content

Commit

Permalink
Create a deep copy of the data object to be stripped and validated.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkpasia committed Jun 22, 2023
1 parent 1feb93d commit 628107e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/components/common/jschema/JSchema.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@
const data = schemaManager.data;
// The following is required to remove all null values from the data object
// We suppose that null values are not valid, hence we remove them
const strippedNullData = stripNullAndEmptyObjectsAndArrays(data);
// Deep copy the data object
const toStripData = JSON.parse(JSON.stringify(data));
const strippedNullData = stripNullAndEmptyObjectsAndArrays(toStripData);
const isDataValid = validator.isValid(strippedNullData);
if (!isDataValid) {
if (handleValidationErrors !== null && handleValidationErrors !== undefined) {
Expand Down

0 comments on commit 628107e

Please sign in to comment.