The DUOS id should be required only if the project is managed access (data_use_restriction = GRU or GRU-NCU)
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:
The if block allows to conditionally require a field
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.
Fixes #1550
Rationale
data_use_restriction = GRU
orGRU-NCU
)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:
DUOS_id
is disallowed for open access projects it should be conditionally defined fordata_use_restriction = GRU
orGRU-NCU
. This is not possible becauseadditionalProperties
is set to false, which means that any property not defined in the main property section will fail validation. RemovingadditionalProperties : false
is not an option because then any undeclared property would also be valid. In draft 9 by the keywordunevaluatedProperties
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 theDUOS_id
to be 0, so that if thedata_use_restriction
isn’t set correctly the schema will not validate.Release notes
For type/project/project.json schema:
DUOS_id
field