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

introduce model validators #2

Open
gi0baro opened this issue May 25, 2022 · 0 comments
Open

introduce model validators #2

gi0baro opened this issue May 25, 2022 · 0 comments
Milestone

Comments

@gi0baro
Copy link
Member

gi0baro commented May 25, 2022

Specifically, support validation functions in models which would operate on the entire records instead of a single field.

Ideal usage should look like this:

class Stuff(Model):
    foo = Field.string()
    bar = Field.string()

    @validator(pre=True)
    def _validate_row_before_fields_validations(self, row):
        ...

    @validator()
    def _validate_row_after_fields_validations(self, row):
        ...

This ideally also solves the actual hackery behind the unique field validator, as with a record validator there's no need to recognize/store primary fields somewhere (see emmett-framework/emmett#428 ).

@gi0baro gi0baro transferred this issue from emmett-framework/emmett Dec 25, 2022
@gi0baro gi0baro added this to the 1.0 milestone Dec 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant