-
Notifications
You must be signed in to change notification settings - Fork 3
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
FEAT: Commons IP schema validation #60
Conversation
- removed expansions of status enums; and - added a `ruleId` alias for validation `rule_id`.
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.
LGTM, however why did you remove spaces from well and not well formed constants?
That's because they're incompatible with commons-ip which doesn't include spaces. I need compatibility to auto compare the results via a JSON deserialisation. Once we have compatibility we can talk about changes, but I can't change commons-ip. |
- added a `model_config` paramter to allow both `rule_id` and `ruleId` as keys in Pydantic model validation; - fixes issue with deserialisation of `rule_id` in `Rule` model.
- added a `model_validator` to the `PackageDetails` class to convert incoming JSON dictionary to a `List` for now; - added PyDantic config to `Result` to allow multiple names for `rule_id` during validation; - reverted change to dictionary as it was not necessary; - added tests and data for deserialisation of commons-ip types; and - fixed minor compiler warnings.
…ator into fix/commons-ip
- refactored `MetadataResults` to match `commons-ip`, it's probably better as well; - moved `name` from `InformationPackage` to `PackageDetails` class; - renamed `InformationPackage.package` to `InformationPackage.details`; - renamed existing `ValidationReport.convert_dict` validator to `ValidationReport.convert_representations_dict` (more explicit); - added a second validator, `VaidationReport.convert_checksum_ids`, to convert `commons-ip` checksum ids to `eark_validator` hyphenated form; - `is_valid` convenience property to `ValidationReport` class; - string constants for 'VALID' and 'INVALID'; and - fixed tests to accomodate.
Final time I promise @dockmd, this is now compatible with commons-ip JSON and the new validator rest service works. |
- added `convert_status` validator to `MetadataResults` class to convert commons-ip `NOTVALID` status to `INVALID`; - moved checksum algorithm ID validation to the `PackageDetails` class; - added test and test data for status conversion; and - fixed type hinting for validation methods to `Any`.
@dockmd, I should have kept my mouth shut. Found another change to make to coerce a final value. I'll take a look at your suggestion about root and get a final commit up shortly. Looking to close this and merge to integrations ASAP as I can then get a test package out and an updated REST validator. |
As suggested in this [review comment](#60 (comment)), thanks.
ruleId
alias for validationrule_id
.