common-workflow-language / schema_salad

Semantic Annotations for Linked Avro Data
https://www.commonwl.org/v1.2/SchemaSalad.html
Apache License 2.0
72 stars 60 forks source link

Add a possibility to specify default values for fields in schema salad #124

Open hmenager opened 6 years ago

hmenager commented 6 years ago

It would be interesting to be able to specify a default value for fields in schema_salad based specs. Currently they are mentioned in the documentation field, but this is not really machine readable (e.g. https://github.com/common-workflow-language/common-workflow-language/blob/master/v1.0/CommandLineTool.yml#L172). Having these would help a lot to generate SDKs ;) cc @anton-khodak @khillion

tetron commented 6 years ago
  1. Add "default" field to Salad metaschema
  2. Add support to Python codegen to set value of "default" on fields which are not loaded from document
  3. Update CWL spec with machine-readable defaults
mr-c commented 3 years ago

2020-12-02 update:

  1. default was added to the schema-salad v1.1 spec: https://www.commonwl.org/v1.1/SchemaSalad.html#Introduction_to_v1.1
  2. No updates have been made to the Python codegen yet about defaults (nor the Java codegen)
  3. There are many defaults set in CWL v1.2, here's PR to add 4 more: https://github.com/common-workflow-language/cwl-v1.2/pull/68