Skip to content

Partial Validation Option #11

@nitipit

Description

@nitipit

Partial Validation Option can be used to validate partial fields of the model.

  • Only validate model with corresponded key.
  • Use by option flag partial=True
class Contact(Model):
    type = Field(require=True).instance(str)\
        .verify(lambda value: value in ['phone', 'email', 'address'])
    note = Field().instance(str)\
        .verify(lambda value: len(value) <= 250)
    value = Field(require=True).instance(str)\
        .verify(lambda value: len(value) <= 1000)

contact = new Contact({type: 'phone'}, partial=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions