This library provides an easy way to convert the input definition of a Common Workflow Language file to a JSON Schema
The primary goal of this library is to facilitate the use of schema-form.
The following is an example CWL CommandLineDefinition.
cwlVersion: v1.0
class: CommandLineTool
inputs:
birth_rate:
type:
type: record
fields:
- id: mean
type: double
- id: median
type: double
outputs: []
baseCommand: echo
The following (very abbreviated) example typescript code is what is used to display the page in the demo
import { JSONSchema6, CwlToJsonSchemaConverter } from '../lib/cwl-to-jsonschema.converter';
CwlToJsonSchemaConverter.convert('Demo Yaml', <yaml string>);
This results in the follow json schema:
{
"type": "object",
"title": "Demo Yaml",
"properties": {
"birth_rate": {
"type": "object",
"required": [
"mean",
"median"
],
"properties": {
"mean": {
"type": "number",
"$id": "mean"
},
"median": {
"type": "number",
"$id": "median"
}
},
"$id": "birth_rate"
}
},
"required": [
"birth_rate"
]
}
This package was created using the typescript-library-starter.