@@ -99,14 +99,24 @@ def get_dict(self):
99
99
:return: dictionnary of the object
100
100
:rtype: DICT
101
101
'''
102
- dict_param = {k : v for k , v in vars (self ).items () if v is not None and v is not False }
103
- if dict_param ['type' ] != 'File' :
104
- # Remove what is only for File
105
- for key in ['format' , 'secondaryFiles' , 'streamable' ]:
106
- try :
107
- del (dict_param [key ])
108
- except KeyError :
109
- pass
102
+ manual = ["type" ]
103
+ dict_param = {k : v for k , v in vars (self ).items () if v is not None and v is not False and k not in manual }
104
+
105
+ should_have_file_related_keys = False
106
+
107
+ if isinstance (self .type , str ):
108
+ dict_param ["type" ] = self .type
109
+ should_have_file_related_keys = self .type == "File"
110
+
111
+ elif isinstance (self .type , CommandInputArraySchema ):
112
+ dict_param ["type" ] = self .type .get_dict ()
113
+ should_have_file_related_keys = self .type .type == "File"
114
+
115
+ keys_to_remove = [k for k in ['format' , 'secondaryFiles' , 'streamable' ] if k in dict_param ]
116
+
117
+ if not should_have_file_related_keys :
118
+ for key in keys_to_remove :
119
+ del (dict_param [key ])
110
120
return dict_param
111
121
112
122
@@ -129,4 +139,15 @@ def __init__(self, items=None, label=None, input_binding=None):
129
139
self .type = "array"
130
140
self .items = parse_param_type (items )
131
141
self .label = label
132
- self .input_binding = input_binding
142
+ self .inputBinding = input_binding
143
+
144
+ def get_dict (self ):
145
+ '''
146
+ Transform the object to a [DICT] to write CWL.
147
+
148
+ :return: dictionnary of the object
149
+ :rtype: DICT
150
+ '''
151
+ dict_binding = {k : v for k , v in vars (self ).items () if v is not None }
152
+ return dict_binding
153
+
0 commit comments