Skip to content

model_validate() returns None instead of model instance #86

@simontaurus

Description

@simontaurus

Problem

LinkedBaseModel.model_validate(data) returns None instead of the validated model instance. The override calls super().model_validate() but doesn't return its result.

Workaround

# Instead of:
instance = MyModel.model_validate(data)  # returns None

# Use:
instance = MyModel(**data)  # works

Expected behavior

model_validate should return the constructed instance, matching pydantic v2's standard behavior.

Location

oold/model/__init__.py, line ~430 — the model_validate classmethod needs return super().model_validate(...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions