@@ -98,7 +98,8 @@ pub fn config_to_preset(config_map: &Value) -> Value {
98
98
}
99
99
}
100
100
101
- /// Keep "{prefix}.#is_none": true, remove all other "{prefix}.*" keys.
101
+ /// Keep "{prefix}.#is_none": true, remove all other "{prefix}.*" keys and also the bare
102
+ /// "{prefix}" key.
102
103
pub fn prune_by_is_none ( mut v : Value ) -> Value {
103
104
let obj: & mut Map < String , Value > =
104
105
v. as_object_mut ( ) . expect ( "prune_by_is_none: expected a JSON object" ) ;
@@ -115,9 +116,13 @@ pub fn prune_by_is_none(mut v: Value) -> Value {
115
116
}
116
117
}
117
118
118
- // Remove keys that begin with any such prefix, except the "#is_none" flag itself
119
+ // Remove keys that begin with any such prefix, or equal the bare prefix, except the "#is_none"
120
+ // flag itself
119
121
obj. retain ( |k, _| {
120
- if let Some ( p) = unset_optional_param_paths. iter ( ) . find ( |p| k. starts_with ( & * * * p) ) {
122
+ if let Some ( p) = unset_optional_param_paths
123
+ . iter ( )
124
+ . find ( |p| k. starts_with ( & * * * p) || k. as_str ( ) == p. trim_end_matches ( FIELD_SEPARATOR ) )
125
+ {
121
126
// keep only the "{prefix}.#is_none" key
122
127
k == & format ! ( "{p}{IS_NONE_MARK}" )
123
128
} else {
@@ -202,6 +207,7 @@ impl DeploymentBaseAppConfig {
202
207
203
208
// Extract only the required fields from the config map.
204
209
let preset = config_to_preset ( & config_as_map) ;
210
+ let preset = prune_by_is_none ( preset) ;
205
211
validate_all_pointer_targets_set ( preset. clone ( ) ) . expect ( "Pointer target not set" ) ;
206
212
preset
207
213
}
0 commit comments