Duke-GCB / bespin-api

Web application for running workflows in the cloud
MIT License
0 stars 2 forks source link

job-templates validate endpoint requires optional fields #202

Closed johnbradley closed 5 years ago

johnbradley commented 5 years ago

Optional fields are causing job template validation to fail. This can be seen on the dev server by going to: https://bespin-dev.gcb.duke.edu/api/v2/job-templates/validate Posting the following data:

{
    "tag": "wes-gatk4-preprocessing/v7/b37-human-xgen-k8s",
    "name": "test",
    "fund_code": "test",
    "job_order": {
         "library":"lib",
         "read_pair": {}
    }
}

You will receive an error like so:

    "job_order.interval_padding": [
        "This field is required."
    ]

The interval padding field in exomeseq-gatk4.cwl is optional and in the past hasn't been specified and was fine.

johnbradley commented 5 years ago

In the WorkflowVersion table the fields contains {"name": "interval_padding", "type": ["null", "int"]}. The CWL type ["null", "int"] means the field is optional.

Currently bespin-api just checks that all fields's keys have a value ignoring the type: https://github.com/Duke-GCB/bespin-api/blob/82921488d7f56ca6bbea40af183d1ba386777aa5/bespin_api_v2/jobtemplate.py#L216-L224

johnbradley commented 5 years ago

Fixed by #203