@@ -32,20 +32,18 @@ def testKubernetesSchema(self):
32
32
self ._write_line (KUBERNETES + ":" )
33
33
self ._write_folder (self .schema_map , False , "" , " " )
34
34
35
- def _write_folder (self , folder , is_multiple , path , indent ):
36
- # for a multiple (object list) type, the first field is prefixed with a hyphen
37
- plain_indent = indent
38
- hyphen_indent = indent [:- 2 ] + "- "
39
- this_indent = plain_indent
40
- if is_multiple :
41
- this_indent = hyphen_indent
35
+ def _write_folder (self , folder , in_array , path , indent ):
36
+ # for an object in an array, the first field is prefixed with a hyphen
37
+ this_indent = plain_indent = indent
38
+ if in_array :
39
+ this_indent = indent [:- 2 ] + "- "
42
40
43
41
properties = wko_schema_helper .get_properties (folder )
44
42
property_names = list (properties .keys ())
45
43
property_names .sort ()
46
44
47
45
sub_folders = PyOrderedDict ()
48
- multi_sub_folders = []
46
+ object_array_keys = []
49
47
for property_name in property_names :
50
48
property_map = properties [property_name ]
51
49
property_type = wko_schema_helper .get_type (property_map )
@@ -67,7 +65,7 @@ def _write_folder(self, folder, is_multiple, path, indent):
67
65
elif wko_schema_helper .is_object_array (property_map ):
68
66
array_items = wko_schema_helper .get_array_item_info (property_map )
69
67
sub_folders [property_name ] = array_items
70
- multi_sub_folders .append (property_name )
68
+ object_array_keys .append (property_name )
71
69
72
70
elif wko_schema_helper .is_simple_array (property_map ):
73
71
array_type = wko_schema_helper .get_array_element_type (property_map )
@@ -98,9 +96,9 @@ def _write_folder(self, folder, is_multiple, path, indent):
98
96
self ._write_line (this_indent + property_name + ":" )
99
97
this_indent = plain_indent
100
98
subfolder = sub_folders [property_name ]
101
- is_multiple = property_name in multi_sub_folders
99
+ in_array = property_name in object_array_keys
102
100
child_indent = this_indent + " "
103
- self ._write_folder (subfolder , is_multiple , next_path , child_indent )
101
+ self ._write_folder (subfolder , in_array , next_path , child_indent )
104
102
105
103
def _write_line (self , text ):
106
104
self .out_file .write (text + "\n " )
0 commit comments