Skip to content

Commit 242d713

Browse files
committed
Fix Non schema elements were not removed when validating configuration
1 parent 03fb103 commit 242d713

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

include/utils/jsonschema/QJsonUtils.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,13 @@ class QJsonUtils
180180
path.takeFirst(); //Remove first item of path
181181
QJsonValue subTarget;
182182
modifyValue(subValue, subTarget, path, newValue);
183-
targetObj.insert(key, subTarget);
183+
184+
//Ignore elements with null values
185+
if (subTarget != QJsonValue::Null)
186+
{
187+
targetObj.insert(key, subTarget);
188+
}
189+
184190
foundKey = true;
185191
}
186192
else
@@ -243,7 +249,11 @@ class QJsonUtils
243249
}
244250
else
245251
{
246-
target = source;
252+
//Do not add elements being null
253+
if (newValue != QJsonValue::Null)
254+
{
255+
target = source;
256+
}
247257
}
248258
}
249259
}

0 commit comments

Comments
 (0)