MCPcopy Create free account
hub / github.com/NVIDIA/NeMo-Relay / merge_json_value

Function merge_json_value

crates/core/src/plugin.rs:965–979  ·  view source on GitHub ↗

Recursively merges `right` into a `left` JSON object; arrays and scalars are replaced.

(left: &mut Json, right: Json)

Source from the content-addressed store, hash-verified

963
964/// Recursively merges `right` into a `left` JSON object; arrays and scalars are replaced.
965fn merge_json_value(left: &mut Json, right: Json) {
966 match (left, right) {
967 (Json::Object(left), Json::Object(right)) => {
968 for (key, value) in right {
969 match left.get_mut(&key) {
970 Some(existing) => merge_json_value(existing, value),
971 None => {
972 left.insert(key, value);
973 }
974 }
975 }
976 }
977 (left, right) => *left = right,
978 }
979}
980
981fn component_kind(component: &Json) -> Option<&str> {
982 component.get("kind").and_then(Json::as_str)

Callers 3

layer_configFunction · 0.85
merge_plugin_componentsFunction · 0.85
merge_pricing_componentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected