cwl-json-schema
TypeScript icon, indicating that this package has built-in type declarations

0.1.1-development • Public • Published

CWL to JSON Schema Converter

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.

CWL:

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

Conversion code:

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>);

Schema:

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"
  ]
}

Credits

This package was created using the typescript-library-starter.

Readme

Keywords

none

Package Sidebar

Install

npm i cwl-json-schema

Weekly Downloads

1

Version

0.1.1-development

License

Apache-2.0

Unpacked Size

4.21 MB

Total Files

38

Last publish

Collaborators

  • nlesc-admin