Add DynamicTable compatibility validators#825
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #825 +/- ##
==========================================
+ Coverage 95.36% 95.37% +0.01%
==========================================
Files 214 215 +1
Lines 7550 7569 +19
==========================================
+ Hits 7200 7219 +19
Misses 350 350 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds reusable MATLAB argument-validation helpers to treat legacy types.core and current types.hdmf_common classes as compatible, enabling arguments-block validation for DynamicTable utilities across schema versions.
Changes:
- Introduces
matnwb.common.validation.internal.mustBeCompatibleTypeto validate a neurodata type name across bothtypes.hdmf_commonand legacytypes.core. - Refactors
mustBeDynamicTableandmustBeVectorDatato delegate validation to the shared helper. - Improves the validator error message specificity by reporting the expected fully-qualified type name that exists on the MATLAB path.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
+matnwb/+common/+validation/mustBeVectorData.m |
Delegates VectorData validation to the new compatibility helper. |
+matnwb/+common/+validation/mustBeDynamicTable.m |
Delegates DynamicTable validation to the new compatibility helper. |
+matnwb/+common/+validation/+internal/mustBeCompatibleType.m |
Adds shared validator that accepts compatible generated types across namespaces and differentiates “wrong type” vs “types missing from path”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
bendichter
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Adds reusable argument-validation functions for
DynamicTableandVectorDatathat accept the type across compatible namespaces —types.hdmf_commonand the legacytypes.core. The error message is specific to the currently generated NWB schema version, to avoid confusion abouthdmf_commonvscorenamespace.Example of current validation:
Error message:
This message is not specific to which NWB schema is currently generated/active. Unless someone is working with legacy schema versions, the
types.core.DynamicTableexpectation is misleading.Example with updated validation function:
For current schema version:
Error message:
For older schema version:
Error message:
What changed
matnwb.common.validation.internal.mustBeCompatibleType(new) — validates a value against a neurodata type name across both compatible namespaces (core/hdmf_common).matnwb.common.validation.mustBeDynamicTable/mustBeVectorData— now delegate to the shared helper.How to test the behavior?
runtests("tests.unit.common.ValidatorTest")Checklist
fix #XXwhereXXis the issue number?