Skip to content

Allows writing but not reading, on model with optional field. #254

Open
@vbabiy

Description

@vbabiy
from typing import Optional
from redis_om import HashModel


class TestObject(HashModel):
    name: str
    age: int
    weight: Optional[float] = None

obj = TestObject(name="Joe", age=20, weight=None)
obj.save()


TestObject.get(obj.pk)

# pydantic.error_wrappers.ValidationError: 1 validation error for TestObject
# weight
#   value is not a valid float (type=type_error.float)

If was able to write it I should be able to read it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions