Open mr-c opened 2 years ago
I did some more thinking about this, and talked with @tetron ;
CWL input and output sections are schemas that are a super-set of schema-salad schemas. So lowering them to schema-salad schemas makes us lose features: secondaryFiles spec & validation; file format spec & validation as both narrow the File
type; there are likely other aspects we would lose by lowering the schema from CWL to schema SALAD format.
So I think we need to gather use cases for what to do with the schema of a CWL workflow/tool input object.
For validating an input object, we can write code to use the TypeScript CWL loader to validate an input object against a CWL tool/workflow description. In this case I would volunteer to write the validator in Python using the cwl-utils
autogenerated CWL objects, that should be straightforward to rewrite into TypeScript by someone with familiarity with that language.
OK, let's see how far we're getting with the input sections we have now, and we can start with validation via the typescript cwl loader.
@mvdbeek proposed using a schema-salad representation of workflow/tool inputs to help build the web UI for executing CWL tools/workflows in Galaxy
I wrote https://github.com/common-workflow-language/cwltool/pull/1748 to add a
--print-input-schema
option tocwltool
Here are some outputs of
cwltool --print-input-schema
for CWL workflows and tools descriptions from the MGnify team:https://gist.github.com/mr-c/3b87d8538817c023197b7ed4bb1f0210#file-raw-reads-wf-v-5-cond_inputs_schema-yml
(Currently, each file has the same boilerplate definitions at the top, but that is likely to be moved to an
$import
from a stable, public URL)These schema salad documents can used by the schema-salad Python library, and/or loaded from a standalone parser like https://github.com/common-workflow-lab/schema-salad-ts-auto for TypeScript
(that parser was generated from the schema-salad codegen feature using the schema salad metaschema :sweat_smile: )
We can also generate that specialized parser for Python, Java, .Net (and any future languages supported by
schema-salad-tool --codegen
)ALSO we can generate a parser for a particular workflow/tool input schema, here's the Python version of that for
raw-reads-wf-v-5-cond.cwl
inputs: https://gist.github.com/mr-c/3b87d8538817c023197b7ed4bb1f0210#file-raw-reads-wf-v-5-cond_inputs_schema-py