Skip to content

Commit ad8291b

Browse files
committed
Add failing tests for list of lists
Signed-off-by: Mohammed Naser <[email protected]>
1 parent 9245007 commit ad8291b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/analyzer.rs

+29
Original file line numberDiff line numberDiff line change
@@ -1380,4 +1380,33 @@ type: object
13801380
let structs = analyze(schema, "Reference", Cfg::default()).unwrap().0;
13811381
assert_eq!(structs[0].members[0].type_, "Option<Vec<ObjectReference>>");
13821382
}
1383+
1384+
#[test]
1385+
fn list_of_lists() {
1386+
init();
1387+
let schema_str = r#"
1388+
properties:
1389+
mounts:
1390+
description: mounts specifies a list of mount points to be setup.
1391+
items:
1392+
description: MountPoints defines input for generated mounts in cloud-init.
1393+
items:
1394+
type: string
1395+
type: array
1396+
type: array
1397+
type: object
1398+
"#;
1399+
1400+
let schema: JSONSchemaProps = serde_yaml::from_str(schema_str).unwrap();
1401+
1402+
let structs = analyze(schema, "KubeadmConfig", Cfg::default()).unwrap().0;
1403+
1404+
let root = &structs[0];
1405+
assert_eq!(root.name, "KubeadmConfig");
1406+
assert_eq!(root.level, 0);
1407+
1408+
let map = &root.members[0];
1409+
assert_eq!(map.name, "mounts");
1410+
assert_eq!(map.type_, "Option<Vec<Vec<String>>>");
1411+
}
13831412
}

0 commit comments

Comments
 (0)