NCATSTranslator / reasoner-validator

Validation of Translator OpenAPI (TRAPI) messages both to TRAPI and Biolink Model standards. See https://ncatstranslator.github.io/reasoner-validator/
Other
2 stars 4 forks source link

crash trying to validate TRAPI response #66

Closed edeutsch closed 1 year ago

edeutsch commented 1 year ago

Describe the bug I tried to validate a TRAPI message and the code crashed

To Reproduce Run same test as in #65 (after working around that error) and get:

$ python3 test_response.py ce6f88f1-4b85-4124-8cf1-7d4cd34f7ab0
Traceback (most recent call last):
  File "/mnt/data/orangeboard/devED/RTX/code/ARAX/ResponseCache/test_response.py", line 73, in <module>
    if __name__ == "__main__": main()
  File "/mnt/data/orangeboard/devED/RTX/code/ARAX/ResponseCache/test_response.py", line 64, in main
    validator.check_compliance_of_trapi_response(envelope)
  File "/mnt/data/python/TestValidator/reasoner_validator/__init__.py", line 154, in check_compliance_of_trapi_response
    elif self.has_valid_query_graph(message) and \
  File "/mnt/data/python/TestValidator/reasoner_validator/__init__.py", line 219, in has_valid_query_graph
    biolink_validator = check_biolink_model_compliance_of_query_graph(
  File "/mnt/data/python/TestValidator/reasoner_validator/biolink/__init__.py", line 846, in check_biolink_model_compliance_of_query_graph
    validator.check_biolink_model_compliance(graph)
  File "/mnt/data/python/TestValidator/reasoner_validator/biolink/__init__.py", line 749, in check_biolink_model_compliance
    self.validate_graph_node(node_id, details)
  File "/mnt/data/python/TestValidator/reasoner_validator/biolink/__init__.py", line 213, in validate_graph_node
    self.validate_category(
  File "/mnt/data/python/TestValidator/reasoner_validator/biolink/__init__.py", line 634, in validate_category
    biolink_class = self.validate_element_status(
  File "/mnt/data/python/TestValidator/reasoner_validator/biolink/__init__.py", line 258, in validate_element_status
    element: Optional[Element] = self.bmt.get_element(name)
  File "/mnt/data/python/TestValidator/bmt/toolkit.py", line 585, in get_element
    element = self.view.get_element(parsed_name)
  File "/mnt/data/python/TestValidator/linkml_runtime/utils/schemaview.py", line 874, in get_element
    e = self.get_class(element, imports=imports)
  File "/mnt/data/python/TestValidator/linkml_runtime/utils/schemaview.py", line 486, in get_class
    c = self.all_classes(imports=imports).get(class_name, None)
  File "/mnt/data/python/TestValidator/linkml_runtime/utils/schemaview.py", line 290, in all_classes
    classes = copy(self._get_dict(CLASSES, imports))
  File "/mnt/data/python/TestValidator/linkml_runtime/utils/schemaview.py", line 416, in _get_dict
    schemas = self.all_schema(imports)
  File "/mnt/data/python/TestValidator/linkml_runtime/utils/schemaview.py", line 235, in all_schema
    return [m[sn] for sn in self.imports_closure(imports)]
  File "/mnt/data/python/TestValidator/linkml_runtime/utils/schemaview.py", line 211, in imports_closure
    imported_schema = self.load_import(sn)
  File "/mnt/data/python/TestValidator/linkml_runtime/utils/schemaview.py", line 185, in load_import
    schema = load_schema_wrap(sname + '.yaml',
  File "/mnt/data/python/TestValidator/linkml_runtime/utils/schemaview.py", line 70, in load_schema_wrap
    schema = yaml_loader.load(path, target_class=SchemaDefinition, **kwargs)
  File "/mnt/data/python/TestValidator/linkml_runtime/loaders/loader_root.py", line 85, in load
    results = self.load_any(*args, **kwargs)
  File "/mnt/data/python/TestValidator/linkml_runtime/loaders/yaml_loader.py", line 32, in load_any
    return self.load_source(source, loader, target_class, accept_header="text/yaml, application/yaml;q=0.9",
  File "/mnt/data/python/TestValidator/linkml_runtime/loaders/loader_root.py", line 58, in load_source
    data = hbread(source, metadata, metadata.base_path, accept_header)
  File "/mnt/data/python/TestValidator/hbreader/__init__.py", line 260, in hbread
    with hbopen(source, open_info, base_path, accept_header, is_actual_data, read_codec) as f:
  File "/mnt/data/python/TestValidator/hbreader/__init__.py", line 188, in hbopen
    raise e
  File "/mnt/data/python/TestValidator/hbreader/__init__.py", line 184, in hbopen
    response = urlopen(req, context=ssl._create_unverified_context())
  File "/mnt/data/python/Python-3.9.13/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/mnt/data/python/Python-3.9.13/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/mnt/data/python/Python-3.9.13/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/mnt/data/python/Python-3.9.13/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/mnt/data/python/Python-3.9.13/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/mnt/data/python/Python-3.9.13/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: https://raw.githubusercontent.com/mnt/data/python/TestValidator/linkml_runtime/linkml_model/model/schema/types.yaml

Expected behavior Successful validation

Additional context Add any other context about the problem here.

CaseyTa commented 1 year ago

I got the same error. Noticed it's introduced with linkml-runtime 1.4.7. https://github.com/linkml/linkml/issues/1314

CaseyTa commented 1 year ago

@edeutsch, linkml-runtime 1.4.8 has been released, which resolves the issue for me.

edeutsch commented 1 year ago

Thanks, @CaseyTa I just tried this, and that seems to have fixed it, thank you!

edeutsch commented 1 year ago

closing this because a newer linkml-runtime fixes it.