Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move generation of DANDI models in LinkML to module level #7

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading