common-workflow-language / cwljava

Java SDK for the Common Workflow Language standards

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using this SDK to generate CWL Documents

MyleneSimon opened this issue · comments

Can this SDK be used to generate CWL documents?
We are trying to add a CWL exporter to our project (we have our workflows stored in a custom format) and since we have a Java backend, I was hopping that we could use the classes generated in this SDK to create the documents and then export them in YAML. However I don't see any setters in the generated classes, or constructors that I could use to export our definitions into CWL CommandLineTool, Workflow, etc. Am I missing something?
I also tried to use schema-salad to re-generate the Java classes but couldn't find the option to generate the classes differently.

Hello @MyleneSimon !

The other SDKs generated using schema-salad support creating and saving, but we didn't get around to adding that to the Java templates yet.

If you are interested in adding that functionality then I can set up a meeting and walk you through the templates.

I'll probably try to enlist @ZimmerA as he implemented those features for the Typescript codegen.

Hi @mr-c !
I can give it a try. I am looking at the schema-salad repo, it looks like I could get started modifying java_codegen.py to add the setters and constructors.
I also see unimplemented Saveable interface/class, is that meant to write to file, or something else?

Great to hear your enthusiasm!

I would look at the Typescript and Python implementations for hints, along with

https://common-workflow-lab.github.io/cwl-ts-auto/

https://cwl-utils.readthedocs.io/en/latest/autoapi/cwl_utils/parser/cwl_v1_2/index.html

https://github.com/common-workflow-language/cwl-utils/blob/main/cwl_utils/parser/cwl_v1_2.py

And common-workflow-language/schema_salad#303 by the original Java implementor @jmchilton may provide inspiration as well. (But don't feel that you have to do it all, any improvement is welcome!)

Just to give a quick update, I added some minimal changes that add the generation of setters and default constructors, it looks like it is enough in our project to be able to generate CWL documents (which we serialize with Jackson). I will test a bit more and push a PR (hopefully some time next week).

That's great news @MyleneSimon , thanks for the update!