Skip to content

Problem with "before" model_validators #8

Open
@daniel-thom

Description

@daniel-thom

Functions like this one are causing us an issue. We are constructing Line from an already-constructed Line_Common instance. The code fails because it expects a dict instead.

I think that the best solution is to make them mode="after" validators instead. I have found it to always be better to use after validators unless I really need to perform some manipulation before Pydantic has run its type conversions. If this function were an after validator then it self would always be a constructed model.

Would you be OK with such a change? We could submit a PR.

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