IHEC / ihec-ecosystems

This repo is for code and documentation associated with the ihec-ecosystems working group
Apache License 2.0
5 stars 6 forks source link

Validator error report improvement: Missing experiment_ontology_uri & experiment_type #64

Closed juettemann closed 4 years ago

juettemann commented 4 years ago

Validator output:

__total_errors__:1                                                                                                                                                                                                                                 
#__validation_error_in__: DRX036828 

# : {'library_strategy': 'Bisulfite-Seq'} is not valid under any of the given schemas
__schema_id__:1
        'experiment_ontology_uri' is a required property
__schema_id__:2
        'experiment_type' is a required property
--------------------------------------------------

The output of the validator should be more clear that only one property is needed, either experiment_ontology_uri or experiment_type

sitag commented 4 years ago

These errors are coming from

   "allOf": [
    {"anyOf": [ ...

constructions used in the schema. Here this one - https://github.com/IHEC/ihec-ecosystems/blob/master/schemas/json/experiment.json#L19-L33

when any none of the schema under "anyOf" match, an error for each is generated. One way to solve this is to "de-normalize" the schema and make full separate schemas duplicating the entire schemas with all of the anyOf forks. This will still be a headache. Simplest way is to check required set of properties outside json schema, like how https://github.com/IHEC/ihec-ecosystems/blob/master/version_metadata/review.py does it, and not even bother with jsonschema if this base level validation fails; jsonschema is just not expressive enough for what we want. Since we also need some additional machinery to check semantic constraints anyway, I think this is the way to go.

sitag commented 4 years ago

prevalidation solves all this

juettemann commented 4 years ago

Agreed, it will solve it once done.