The following model validation fails on an empty list:
import polars as pl
from patito import Model
class TestModel(Model):
list_field: list[str]
df = pl.DataFrame({"list_field": [["a", "b"], []]})
TestModel.validate(df)
With the error message:
DataFrameValidationError: 1 validation error for TestModel
list_field
1 missing value in lists (type=value_error.missingvalues)
I would expect an empty list to validate as list[str], at least Pydantic thinks so:
from pydantic import BaseModel
class TestPydanticModel(BaseModel):
list_field: list[str]
TestPydanticModel(list_field=[]) # happy
The following model validation fails on an empty list:
With the error message:
I would expect an empty list to validate as
list[str]
, at least Pydantic thinks so: