-
Notifications
You must be signed in to change notification settings - Fork 531
BugFix: controlled vocab values validation #11950
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
base: develop
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| i.remove(); | ||
| continue; | ||
| } | ||
| if (isControlledVocabulary && dsf.getDatasetFieldType().getControlledVocabularyValue(v) == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if these changes are needed (the ones in this class. I can see why the change in DatasetPage is important)? At a minimum, I think if isControlledVocabulary is true, there shouldn't ever be a regular value unless it's temporary, so you could always remove it in that case (possibly just adding || isControlledVocabulary to line 1795 instead of a second if statement.
Beyond that though - we are hopefully never adding a temporary value that is not blank or NA_VALUE, so I'd think that the original code should catch and remove the temp value without changes in this class (with your change to DatasetPage). (If not - if there are temp values getting added that are other strings, maybe we should find/fix those? Or catch them for normal fields too and not just controlled vocab?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ErykKul - just a ping - this is waiting on you for a response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mixing two things here, the code here was for removing no-longer-existing vocab values, but I am not sure if that was a good idea, and definitely should not be mixed in this PR with the bug solution for "valid" empty values (I first though it was the reason for them being empty and valid: an old controlled vocabulary value that was removed from the metadata-block shows empty but it is not empty and it is not NA value -> however, that was not the reason for the bug, I could reproduce it in a way as the issue describes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also removed the unit test; it was testing the not-in-vocabulary value in CV field:
DatasetField subjectField = new DatasetField();
subjectField.setDatasetFieldType(subjectType);
subjectField.setDatasetFieldValues(new ArrayList<>());
subjectField.setControlledVocabularyValues(new ArrayList<>());
DatasetFieldValue orphanValue = new DatasetFieldValue(subjectField);
orphanValue.setValue("__placeholder__");
subjectField.getDatasetFieldValues().add(orphanValue);This is not the cause of the bug, so it was testing the wrong thing (and started failing after cleanup of the file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also re-added workingVersion.validate(); in DatasetPage, it has side effects we still want to have (set validation messages on dataset fields, that are then showed in the UI).
|
FWIW: The previous build had a failure in the Harvest from DataCite test, but just rerunning the job fixed it, so presumably random/transient and not related to this PR. |
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
qqmyers
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. isValid() is checking that the version is valid after removal of temporary N/A values which makes sense. Not sure the underlying code is very efficient (cloning the version) but we use it elsewhere.
|
@stevenferey @ErykKul |
…led vocabulary fields
…values are selected, preventing invalid N/A placeholders.
|
📦 Pushed preview images as 🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
What this PR does / why we need it:
Bug fix.
Which issue(s) this PR closes:
Special notes for your reviewer:
Suggestions on how to test this:
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?:
Additional documentation: