Skip to content

introduce model validators #2

Description

@gi0baro

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 ).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions