Repository: common-workflow-language/cwltool

Issue:
Type property "ordereddict([('type', 'array'), ('items', 'array')])" not a valid Avro schema:
https://github.com/ska-sa/den/blob/9858bd1b76ea1793e855d13fed488e9a0cd456c0/steps/casa_applycal.cwl

```
$ .venv2/bin/cwltool main.cwl
.venv2/bin/cwltool 1.0.20180330141240
Resolved 'main.cwl' to 'file:///Users/gijs/Work/den/main.cwl'
Tool definition failed initialization:
Tool definition file:///Users/gijs/Work/den/steps/casa_applycal.cwl failed validation:
  Got error 'Type property "ordereddict([('type', 'array'), ('items', 'array')])" not a valid Avro schema: Items schema (array) not a valid Avro schema: Cou
ld not make an Avro Schema object from array. (known names: [u'applymode361d19c1-d901-456f-a104-dd35a2feea68', u'File_class', 'File', 'Directory', 'input_re
cord_schema', u'Directory_class', 'Any'])' while processing inputs of file:///Users/gijs/Work/den/steps/casa_applycal.cwl:
[...]
```


Discussion:

Resolving patch:
diff --git a/cwltool/process.py b/cwltool/process.py
--- a/cwltool/process.py
+++ b/cwltool/process.py
@@ -482,23 +482,16 @@ def __init__(self, toolpath_object, **kwargs):
                 elif key == "outputs":
                     self.outputs_record_schema["fields"].append(c)
 
-        try:
-            self.inputs_record_schema = cast(Dict[six.text_type, Any], schema_salad.schema.make_valid_avro(self.inputs_record_schema, {}, set()))
+        with SourceLine(toolpath_object, "inputs", validate.ValidationException):
+            self.inputs_record_schema = cast(
+                Dict[six.text_type, Any], schema_salad.schema.make_valid_avro(
+                    self.inputs_record_schema, {}, set()))
             AvroSchemaFromJSONData(self.inputs_record_schema, self.names)
-        except avro.schema.SchemaParseException as e:
-            raise validate.ValidationException(u"Got error '%s' while "
-                    "processing inputs of %s:\n%s" %
-                                               (Text(e), self.tool["id"],
-                                                json.dumps(self.inputs_record_schema, indent=4)))
-
-        try:
-            self.outputs_record_schema = cast(Dict[six.text_type, Any], schema_salad.schema.make_valid_avro(self.outputs_record_schema, {}, set()))
+        with SourceLine(toolpath_object, "outputs", validate.ValidationException):
+            self.outputs_record_schema = cast(Dict[six.text_type, Any],
+                    schema_salad.schema.make_valid_avro(
+                        self.outputs_record_schema, {}, set()))
             AvroSchemaFromJSONData(self.outputs_record_schema, self.names)
-        except avro.schema.SchemaParseException as e:
-            raise validate.ValidationException(u"Got error '%s' while "
-                    "processing outputs of %s:\n%s" %
-                                               (Text(e), self.tool["id"],
-                                                json.dumps(self.outputs_record_schema, indent=4)))
 
         if toolpath_object.get("class") is not None and not kwargs.get("disable_js_validation", False):
             if kwargs.get("js_hint_options_file") is not None:


Test patch: