Skip to content
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

Merged
merged 10 commits into from
Aug 29, 2024
Merged

FEAT: Commons IP schema validation #60

merged 10 commits into from
Aug 29, 2024

Conversation

carlwilson
Copy link
Member

  • removed expansions of status enums; and
  • added a ruleId alias for validation rule_id.

- removed expansions of status enums; and
- added a `ruleId` alias for validation `rule_id`.
@carlwilson carlwilson requested a review from dockmd August 13, 2024 11:07
@carlwilson carlwilson self-assigned this Aug 13, 2024
Copy link
Collaborator

@dockmd dockmd left a 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?

@carlwilson
Copy link
Member Author

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.
- 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.
@carlwilson carlwilson requested a review from dockmd August 28, 2024 13:30
@carlwilson
Copy link
Member Author

Final time I promise @dockmd, this is now compatible with commons-ip JSON and the new validator rest service works.

eark_validator/structure.py Outdated Show resolved Hide resolved
- 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`.
@carlwilson carlwilson requested a review from dockmd August 29, 2024 09:27
@carlwilson
Copy link
Member Author

@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.
@carlwilson carlwilson merged commit d1cea32 into integration Aug 29, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants