Skip to content

YAN-1374: Added schema for metadata YAML. Add validate() method to MetaData...

James Strauss requested to merge yan-1374-schema-validation into main

Defines a schema for metadata files (src/ska_sdp_dataproduct_metadata/schema/metadata.json)

Adds a new instance of a jsonschema Validator to the MetaData class: MetaData.validator

Adds a method (validate()) to the MetaData class to validate the contents of a MetaData object against the schema. Also automatically calls validate() when writing a file using write()

The schema is largely unchanged from the schema currently used in ska-sdp-dataproduct-api when ingesting data products. It is very permissive, the only required element is the execution block id. It's main purpose is to check type compliance. It adds an optional 'size' attribute to each element of the files array.

If this change is approved and released, I'll update ska-sdp-dataproduct-api to use the validator in this package.

This change also removes many of the obscore attributes from the default template. These defaults had null values, which are not permitted by the schema. The expected outputs in the test resources were modified to mirror the change to the default template.

Also includes updates to documentation, and a new unit test to check that an Exception is raised when writing a MetaData object where the execution block id is missing.

Edited by James Strauss

Merge request reports