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

Use unified entity validators #46

Merged
merged 10 commits into from
Jul 8, 2024

Conversation

kellnerd
Copy link
Contributor

Make use of the new unified entity validation functions from metabrainz/bookbrainz-data-js#316.

The main change is that we are now catching the (first) ValidationError which is thrown by the validation functions and log it in one central place instead of collecting all error messages and logging them inline in an otherwise identical validation function.
I think the change to not log all errors is fine since in most cases there should not be any error.

Since we are reusing the existing validation functions now, we can finally validate series as well.

Through the refactoring we have also lost the nil check for the whole validation object which happened in each validator, but this was unnecessary since we are constructing these (non-empty) objects from the queued entities ourselves.

Some changes which end up being moved into bookbrainz-data were done here before the validators have been deleted, so this PR is best reviewed commit by commit.

P.S. Unfortunately the separate commits also contain a lot of noise because ESLint forced me to reorder import statements back and forth because of the stupid rule to separate single import and multiple import specifiers. In some cases the addition/removal of imports also caused changes in the alphabetic order... This really made me feel that we should consider ordering imports by module name instead, this would result in a more stable order.

Copy link
Contributor

@MonkeyDo MonkeyDo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@MonkeyDo MonkeyDo merged commit b99fa63 into metabrainz:master Jul 8, 2024
@kellnerd kellnerd deleted the entity-validators branch July 8, 2024 10:44
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