This project contains .Net objects and utilities auto-generated by https://github.com/common-workflow-language/schema_salad for parsing documents corresponding to the https://w3id.org/cwl/cwl schema
// Specify the CWL file to load
Uri fileUri = new Uri(Path.GetFullPath("my-cwl-document.cwl"));
// Read the file contents
string fileContent = System.IO.File.ReadAllText(fileUri.AbsolutePath);
// Parse the CWL document
var doc = CWLDotNet.RootLoader.LoadDocument(fileContent, fileUri.AbsoluteUri);
// Work with the document
doc.Switch(
CommandLineTool => Console.WriteLine("The loaded document is a CommandLineTool"),
ExpressionTool => Console.WriteLine("The loaded document is a ExpressionTool"),
Workflow => Console.WriteLine("The loaded document is a Workflow"),
Operation => Console.WriteLine("The loaded document is an Operation"),
ListOf => Console.WriteLine("This is a list of one of: CommandLineTool | ExpressionTool | Workflow | Operation")
);
using System.Text.Json;
using CWLDotNet;
// Create a CommandLineTool with empty inputs and outputs
CommandLineTool mytool = new CommandLineTool(new(),new());
// Set the base command
mytool.baseCommand = "echo";
// Create an input parameter with a default value
CommandInputParameter input1 = new CommandInputParameter(CWLType.INT);
input1.default_ = "Hello World!";
// Add the input to the tool
mytool.inputs.Add(input1);
// Serialize the tool
string outDoc = JsonSerializer.Serialize(mytool.Save());
The complete documentation, autogenerated by DocFX can be found under the following link: https://common-workflow-lab.github.io/CWLDotNet/
CWLDotNet only supports the CWL v1.2 syntax. Other documents have to be upgraded using the cwl-upgrader