in tools/code/common/Configuration.cs [108:144]
private static JsonObject OverrideWith(JsonObject current, JsonObject other)
{
var merged = new JsonObject(nodeOptions);
foreach (var property in current)
{
string propertyName = property.Key;
var currentPropertyValue = property.Value;
if (other.TryGetPropertyValue(propertyName, out var otherPropertyValue))
{
if (currentPropertyValue is JsonObject currentObject && otherPropertyValue is JsonObject otherObject)
{
merged[propertyName] = OverrideWith(currentObject, otherObject);
}
else
{
merged[propertyName] = otherPropertyValue?.DeepClone();
}
}
else
{
merged[propertyName] = currentPropertyValue?.DeepClone();
}
}
foreach (var property in other)
{
string propertyName = property.Key;
if (current.ContainsKey(propertyName) is false)
{
merged[propertyName] = property.Value?.DeepClone();
}
}
return merged;
}