-
-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Hello,
I was wondering if there is a way to use the json schema specified in cwl.yaml to auto-complete / lint my code before running cwltool validate
.
I performed the following commands to get my json schema:
wget \
--quiet \
--output-document /dev/stdout \
"https://raw.githubusercontent.com/common-workflow-language/cwl-v1.2/main/json-schema/cwl.yaml" | \
yq --output-format=json > cwl_mappings.json
In my JetBrains IDE,
Under Languages & Frameworks -> Schemas and DTDs -> _JSON Schema Mappings, I configured the following:
- Schema file or URL to match the downloaded path above
- File path pattern set to *.cwl
After restarting my IDE, nothing changes.
Having a look at some other schema definitions (that do work in my IDE) such as the [GitHub Actions Workflow Json](https://json.schemastore.org/github-workflow.json, I noticed that this had many more higher level fields.
Notably the additionalProperties
field was set to false.
I tried changing the additionalProperties and allOf field in the top level to the following:
allOf:
- $ref: '#/$defs/CWL'
additionalProperties: false
so that the properties in the top level of the CWL file would need to match one of CWLWorkflow, CWLGraph or CWLAtomic
This worked! ...sort of.
It now thinks we're in the $graph version deployment.
This is likely caused because CWLGraphBase has additionalProperties: {}
.
After updating all items of $defs
that match type object to have additionalProperties: false
and all items of $defs
that match type array to have additionalItems: false
.
Presto!
However, workflows still have issues for the class definition as it thinks it should be of the type 'CommandLineTool'
I'll keep tinkering around but would be great to see if this json schema could also be auto-generated.