-
Notifications
You must be signed in to change notification settings - Fork 32
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
EDTF validation constraint #78
Conversation
... to be sure that the field at least contains _some_ form of EDTF.
Note sure if this would help but this should have the "bad" characters I think https://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html |
I tested with dates of '2021-01-01-01' and 'France' which fail the widget's validation but can be entered through Migrate. However even with this code in place,my migrations (migrate islandora csv) still seem to let them in to the date (EDTF) fields. Is there anything I have to do to "enable validation" other than have this code in place? I tried setting validate: true in the destination setting of the yaml per this issue, but still the same result. |
@rosiel : Nah, that should do it; however:
... "in place", would mean in the active configuration, and not just in whatever config entity in code in
... something of an aside, but: I see those "example" migrations claiming to be in the ... a second aside, but: I've taken to start avoiding using |
@DonRichards: Input encoding validation is well beyond the scope of this... would be up to whatever mechanisms that are accepting input (such as the forms, or CSV parsers, or whatever) to ensure that things are encoded/decoded appropriately. |
Thanks @adam-vessey . When I added the validate:true line to the yaml, I did it through the config sync export/import route. It appears to be reading my changes to the spreadsheet file in the data directory, so that's good. (oh, i didn't cache clear. Turns out you need to cache clear.) OK, success - the three ones I messed with did not import. Is there any message anywhere about why they failed and which ones they were? |
@rosiel: There's a few ways to see 'em:
However, one thing to note: These tables are wiped with each invocation of the migration... so if you run the migration and it dumps whatever errors in the messages table, but then try to run the migration again, the error messages would be lost. |
OK, I'm still not having any luck finding the messages. The GUI shows 0 messages for the partial migration with some validation errors, and I am not sure how to use Drush on the ISLE instance I'm testing with. I'm not so hung up on messages as to think we shouldn't accept this improvement, though. For the purpose of documentation, did your tests yield migrate messages explaining which failed? |
GitHub Issue: Islandora/documentation#1859
Release pull requests, etc.)
What does this Pull Request do?
Add a validation constraint to the EDTF field type, to ensure stored values pass basic validation.
What's new?
The validation constraint for EDTF fields.
(i.e. Regeneration activity, etc.)? No.
How should this be tested?
Could be done a couple of ways... with the code deployed:
Additional Notes:
The settings from the widget are presently ignored by the constraint implementation, as there's not really a nice way to allow for later widening conversions of fields if desired... so the constraint allows both intervals and sets; however, it does not perform the "strict" validation, due to other issues with it...
... "strict" validation presently attempts to parse values into a
DateTime
object, which will fail with valid EDTF values such as:2021-21
(to mean "Spring, 2021")DateTime
fails, due to attempting to use the "21st" month19XX-12-31
(to mean "December 31st at some point in the 1900s", kind of thing)DateTime
Interested parties
Tag (@ mention) interested parties or, if unsure, @Islandora/8-x-committers