linkml / linkml-runtime

Runtime support for linkml generated models
https://linkml.io/linkml/
Creative Commons Zero v1.0 Universal
24 stars 23 forks source link

Added a ReferenceValidator that performs complete normalizations. #239

Closed cmungall closed 1 year ago

cmungall commented 1 year ago

This PR implements a reference validator, which is intended to be a direct implementation of part 5 of the spec

This also performs instance normalization as defined in part 6 of the spec

The test suite performs auto-documentation, generating a markdown file as output that will serve as a reference document for validators.

The PR also introduces a temporary validation datamodel that forks the core linkml-model one, with the plan to fold these changes back in.

Note the current implementation may be incomplete.

There is a very preliminary CLI:

linkml-normalize --help
Usage: linkml-normalize [OPTIONS] INPUT

  Normalizes and validates a YAML document against a schema.

  Normalization is a mix of casting types (e.g. "5" to 5), as well as LinkML
  *collection forms*, e.g. ExpandedDict to CompactDict.

  Validations is performed using a derived schema, as per part 5 of the
  specification.

  Note that in future this will be folded into the main linkml-validate
  command.

  Currently this CLI lacks features such as the ability to customize which
  severity rules to fail on.

  :param schema: :param target: :param input: :param output: :return:

Options:
  -s, --schema TEXT      [required]
  -C, --target TEXT
  -o, --output FILENAME
  --help                 Show this message and exit.
codecov-commenter commented 1 year ago

Codecov Report

Merging #239 (f597921) into main (b992fe0) will increase coverage by 0.24%. The diff coverage is 45.33%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #239      +/-   ##
==========================================
+ Coverage   63.54%   63.78%   +0.24%     
==========================================
  Files          53       53              
  Lines        6117     6188      +71     
  Branches     1650     1678      +28     
==========================================
+ Hits         3887     3947      +60     
+ Misses       1774     1762      -12     
- Partials      456      479      +23     
Impacted Files Coverage Δ
linkml_runtime/utils/schemaview.py 82.89% <33.87%> (-3.51%) :arrow_down:
linkml_runtime/dumpers/rdflib_dumper.py 97.91% <100.00%> (ø)
linkml_runtime/utils/namespaces.py 73.05% <100.00%> (+2.16%) :arrow_up:
linkml_runtime/utils/yamlutils.py 78.15% <100.00%> (ø)
linkml_runtime/linkml_model/meta.py 53.93% <0.00%> (+1.14%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.