Skip to content

Using Field from a different class causes the validator to wrongly assume there are multiple primary keys #671

Closed
@sherpya

Description

@sherpya

the code in RedisModel validate_primary_key wrongly assumes there are multiple primary keys:

            if getattr(field_info, "primary_key", None):
                primary_keys += 1

should really be:

            if getattr(field_info, "primary_key", None) is True:
                primary_keys += 1

because I'm getting PydanticUndefined sometimes instead of None

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