Skip to content

Commit 91929a7

Browse files
authored
Fix x-kubernetes-preserve-unknown-fields with type array (#314)
Signed-off-by: Mohammed Naser <[email protected]>
1 parent 4fdf728 commit 91929a7

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/analyzer.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,7 @@ fn array_recurse_for_type(
427427
match items {
428428
JSONSchemaPropsOrArray::Schema(s) => {
429429
if s.type_.is_none() && s.x_kubernetes_preserve_unknown_fields == Some(true) {
430-
let map_type = cfg.map.name();
431-
return Ok((format!("Vec<{}<String, serde_json::Value>>", map_type), level));
430+
return Ok(("Vec<serde_json::Value>".to_string(), level));
432431
}
433432
let inner_array_type = s.type_.clone().unwrap_or_default();
434433
return match inner_array_type.as_ref() {
@@ -1173,10 +1172,7 @@ type: object
11731172
assert_eq!(root.level, 0);
11741173
assert!(!root.is_enum);
11751174
assert_eq!(&root.members[0].name, "patchesStrategicMerge");
1176-
assert_eq!(
1177-
&root.members[0].type_,
1178-
"Option<Vec<BTreeMap<String, serde_json::Value>>>"
1179-
);
1175+
assert_eq!(&root.members[0].type_, "Option<Vec<serde_json::Value>>");
11801176
}
11811177

11821178
#[test]

0 commit comments

Comments
 (0)