Skip to content

Commit

Permalink
Merge pull request #7 from candleindark/improve-dandiset-linkml-valid…
Browse files Browse the repository at this point in the history
…ator

Move generation of DANDI models in LinkML to module level
  • Loading branch information
candleindark authored Sep 21, 2024
2 parents 10ec848 + ac70db4 commit 5fa3af4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/dandisets_linkml_status_tools/cli/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@

logger = logging.getLogger(__name__)

# The names of the collection of modules in which the DANDI models are defined
DANDI_MODULE_NAMES = ["dandischema.models"]

# The LinkML schema produced by the pydantic2linkml translator for DANDI models
DANDI_LINKML_SCHEMA = translate_defs(DANDI_MODULE_NAMES)

# A callable that sorts a given iterable of strings in a case-insensitive manner
isorted = partial(sorted, key=str.casefold)

Expand Down Expand Up @@ -74,15 +80,11 @@ def __init__(self, validation_plugins: Optional[list[ValidationPlugin]] = None):
the LinkML validator with. If no validation plugins are given, the default of a
list containing a `JsonschemaValidationPlugin` instance with `closed=True`.
"""

# The names of the collection of modules in which the DANDI models are defined
dandiset_module_names = ["dandischema.models"]

if validation_plugins is None:
validation_plugins = [JsonschemaValidationPlugin(closed=True)]

self._inner_validator = Validator(
translate_defs(dandiset_module_names),
DANDI_LINKML_SCHEMA,
validation_plugins=validation_plugins,
)

Expand Down

0 comments on commit 5fa3af4

Please sign in to comment.