biothings / discovery-app

The Data Discovery Engine project by the CD2H Data working-group
http://discovery.biothings.io
Apache License 2.0
4 stars 12 forks source link

Support any class from the registered schemas in metadata_validator #229

Closed newgene closed 4 months ago

newgene commented 1 year ago

We currently have a Metadata Validator at https://discovery.biothings.io/validator. For the initial release, we picked a few supported schema classes:

image

We can expand the support for any class from the registered schemas now (if that class includes schema validation rules of course). Two new features are expected:

marcodarko commented 1 year ago

Just something I noticed while trying different classes on the validator, perhaps we need to adjust the error handling. A class that does not exist 500 err A class that exists from schema.org but has no validation 500 err A class that exists but has no validation and of course a class with validation returns correctly 1. https://discovery.biothings.io/api/schema/n3c:Thing/validation Traceback (most recent call last): File "/Users/marco/Desktop/code/discovery-app/env/lib/python3.9/site-packages/tornado/web.py", line 1711, in _execute result = method(*self.path_args, *self.path_kwargs) File "/Users/marco/Desktop/code/discovery-app/discovery/handlers/api/schema.py", line 563, in get self.finish(validation_dict) UnboundLocalError: local variable 'validation_dict' referenced before assignment 2. https://discovery.biothings.io/api/schema/schema:ExerciseGym/validation Traceback (most recent call last): File "/Users/marco/Desktop/code/discovery-app/env/lib/python3.9/site-packages/tornado/web.py", line 1711, in _execute result = method(self.path_args, **self.path_kwargs) File "/Users/marco/Desktop/code/discovery-app/discovery/handlers/api/schema.py", line 559, in get for data_dict in schema_metadata["@graph"]: KeyError: '@graph' 3. returns { } (expected, should be fine)