-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using json-schema/cwl.yaml to validate CWL files inside IDE is not working correctly. #278
Comments
Tagging @fmigneault who hand wrote (!!) the existing json schema Yes, it would be great if schema-salad or another tool could produce the JSON Schema version automatically! |
I'm using an equivalent config in PyCharm with the reference to the remote YAML schema. |
Thanks @fmigneault I'm having the same issue using a conditional on the CWL attribute, I'll keep tinkering. I don't think it's a JetBrains issue though, I'm using an online json schema validator to compare and getting the same issue - https://www.jsonschemavalidator.net/ |
Three days in a rabbit hole! Very excited to see the daylight again!! I've got the following working for me now! |
@mr-c Therefore, should the features proposed in common-workflow-lab/cwl-ts-auto#27 be instead triggered by the CI of this repo, to invoke |
I'm not sure how the cwl-ts-auto creation works, the repository's main branch hasn't been updated in a couple of years. But happy to move it back to this repo instead. Would prefer to keep it as JSON as some of the IDE importers expect a url to a JSON file but can also convert back to YAML in addition for readability. Would also be great to be able to register it with JSON Schema store as well |
Yes, but it is manually updated; we don't automatically regenerate when schema-salad and/or the CWL schema is updated. And we use https://github.com/common-workflow-language/cwl-v1.2/blob/main/CommonWorkflowLanguage.yml as the root schema
I'm happy for the JSON-schema to live here, so it gets published to the website under https://w3id.org/cwl/ a.k.a. https://www.commonwl.org/v1.2/ However I would be uncomfortable about automatically updating it without some automated tests of the result. |
Cool, I didn't know about the JSON Schema Store. I would request that a URL like |
The other option would be to teach schema-salad how to produce JSON schema directly, without going through the typescript generation→conversion→cleanup process. This will now be a lot easier as you would be able to compare the direct JSON schema serialization to the result of @alexiswl 's converter. |
Should that be a manual PR for now? Can copy over the outputs from the cwl-ts-auto GH actions workflow |
I agree this would be the best option. I didn't go through that path originally because I add a pre-made CWL JSON-schema equivalent, and it was faster to tweak it than implement schema-salad ⇾ JSON-schema from scratch, but it is what I would have done otherwise.
Once converted, it would be easy to validate the resulting JSON by passing the path here:
This will run it against all https://github.com/common-workflow-language/cwl-v1.2/blob/main/conformance_tests.yaml |
Ah I missed this, built my own integration in GH actions instead here |
@mr-c @alexiswl Line 3 in b60a42e
I would love to have an official: |
I think an automatic PR to this repo whenever the json schema is updated in cwl-ts-auto could be feasible? |
Maybe something can be configured with a push to |
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:
In my JetBrains IDE,
Under Languages & Frameworks -> Schemas and DTDs -> _JSON Schema Mappings, I configured the following:
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:
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 haveadditionalProperties: false
and all items of$defs
that match type array to haveadditionalItems: 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.
The text was updated successfully, but these errors were encountered: