HumanCellAtlas / metadata-schema

This repo is for the metadata schemas associated with the HCA
Apache License 2.0
64 stars 32 forks source link

adds DUOS id field #1551

Closed idazucchi closed 4 months ago

idazucchi commented 4 months ago

Fixes #1550

Rationale

  1. The DUOS id should be required only if the project is managed access (data_use_restriction = GRU or GRU-NCU)
  2. If the project is open access (data_use_restriction = NRES ) DUOS_id should be forbidden. This way if a project is erroneously marked as open access we can’t export it with a DUOS id.

Implementation:

  1. The if block allows to conditionally require a field
  2. To make sure that DUOS_id is disallowed for open access projects it should be conditionally defined for data_use_restriction = GRU or GRU-NCU. This is not possible because additionalProperties is set to false, which means that any property not defined in the main property section will fail validation. Removing additionalProperties : false is not an option because then any undeclared property would also be valid. In draft 9 by the keyword unevaluatedProperties allows to define properties in subschemas, but we are using draft7 so this option is not available to us right now. The compromise I made is to require the length of the DUOS_id to be 0, so that if the data_use_restriction isn’t set correctly the schema will not validate.

Release notes

For type/project/project.json schema: