Skip to content
This repository was archived by the owner on Apr 10, 2023. It is now read-only.
This repository was archived by the owner on Apr 10, 2023. It is now read-only.

Use inspect to determine parameters for serialize, deserialize, and validate methods #61

@rossmacarthur

Description

@rossmacarthur

This would allow variable arguments for serialize, deserialize, and validate methods. This is to faciliate cases where Field serialization, deserialization, and validation is dependent for example on the parent model.

We could either do it based on the number of arguments (1) or based on the argument names (2).

For example (1):

# If there is only a single parameter then pass the value
validate(value)

# If there is two parameters pass the value and the current model
validate(value, model)

# If there is three parameters pass the value, the current model, and the parent model?
validate(value, model, parent_model)

For example (2):

# Detect the argument names so all the above would be possible, as well as
validate(value, parent_model)
validate(model, value)
# etc...

The more important question is perhaps what we would like to be passed. Is it the Model instance that is in the process of being deserialized (pre normalization). Or the Model class, or perhaps either or?

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions