Closed aaraney closed 8 months ago
The issue stems from how pydantic<2 and pydantic>2 treat Optional
fields. For example:
from pydantic import BaseModel
from typing import Optional
class Foo(BaseModel):
field: Optional[str]
# valid in pydantic<2
inst = Foo()
assert inst.field == None
# pydantic ValidationError in pydantic>2
# b.c. Optional fields are indicate either Some(value) or None, but either must be present
inst = Foo()
# Must either explicitly set field=None, or change Foo so that field has a default value of None
You can read more about the differences between pydantic versions here.
Below are the two places that are affected:
Failure in gh action.
Related to #228
Reproduce Issue
Note, ive tested that this failed on all versions of
pydantic>2
.