Closed ltuijnder closed 1 year ago
Right. Wanna try to create a PR for it? 👀
It looks like None IS NOT added if nothing was specified for default in the first place as below. Is this expected behavior?
class Spam(BaseModel):
s: int | None = Field(description="spam")
@Kludex I tried to fix this issue with https://github.com/pydantic/bump-pydantic/pull/126
Required Optional Fields (eg. fields that are allowed to be None but should explicitly be specified) are made non-Required when
Field
+...
ellipse was used.For example, using
bump-pydantic
on the official pydantic v1.10 example: https://docs.pydantic.dev/1.10/usage/models/#required-optional-fieldsTurns the following code:
Into:
While one would have expected:
bump-pydantic version = v0.6.1 (as of writing the lastest version)