-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
588 Add check on file export to ensure all required properties are fi…
…lled out (#600) * Update metaclass to instrospect required properties * Minor fixes to MetaClass wrt checking required properties * Display classname in warning for missing required properties * Add custom constraint checks (Issue #588 ) * Update multipleConstrainedTest, add required dataset in type * Update linkTest to pass required property check * Update anonTest to pass required property check * Add explanations for custom constraints * Add unittest to test changes made in this PR * Hardcode exceptions for warnIfMissingRequiredProperties + Fix syntax error (missing end) in nwbExportTest * Fix test for special case dataset starting_time in TimeSeries * Change test workflow to upload test results also if tests fails * Fix more issues with test workflow
- Loading branch information
1 parent
5cd6af6
commit 95b5e5e
Showing
12 changed files
with
212 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
function customConstraintStr = fillCustomConstraint(nwbType) | ||
% fillCustomConstraint - Create functions to check custom constraints | ||
% These are constraints that can not be inferred from the nwb-schema | ||
% | ||
% Reference: https://github.com/NeurodataWithoutBorders/matnwb/issues/588 | ||
|
||
switch nwbType | ||
|
||
case "TimeSeries" | ||
% Add method to validate constraint that either timestamps or | ||
% starting_time must be present | ||
customConstraintStr = sprintf( [... | ||
'function checkCustomConstraint(obj)\n', ... | ||
' assert(~isempty(obj.timestamps) || ~isempty(obj.starting_time), ...\n', ... | ||
' "''timestamps'' or ''starting_time'' must be specified")\n', ... | ||
' if ~isempty(obj.starting_time)\n', ... | ||
' assert(~isempty(obj.starting_time_rate), ...\n', ... | ||
' "''starting_time_rate'' must be specified when ''starting_time'' is specified")\n', ... | ||
' end\n', ... | ||
'end'] ); | ||
|
||
|
||
case "ImageSeries" | ||
% If external_file is set, it does not make sense to fill out the | ||
% data property. However, data is a required property, so this | ||
% method will add a nan-array to the data property so that it passes | ||
% the requirement check on file export. | ||
customConstraintStr = sprintf( [... | ||
'function checkCustomConstraint(obj)\n', ... | ||
' if ~isempty(obj.external_file) && isempty(obj.data), ...\n', ... | ||
' obj.data = nan(1,1,2);\n', ... | ||
' end\n', ... | ||
'end'] ); | ||
|
||
otherwise | ||
customConstraintStr = ''; | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ on: | |
branches: | ||
- master | ||
push: | ||
branches-ignore: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
|
This file contains 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
This file contains 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