Closed brian-goo closed 1 year ago
None should be added if nothing was specified for default of Field if I understood correctly. This PR is to fix https://github.com/pydantic/bump-pydantic/issues/113 as well.
default
Before:
class Foo(BaseModel): a: Optional[int] = Field() # here b: Optional[int] = Field(...) c: Optional[int] = Field(None, description="spam") d: Optional[int] = Field(description="spam") # here e: Optional[int] = Field(default=..., description="spam") f: Optional[int] = Field(default=None, description="spam")
After:
class Foo(BaseModel): a: Optional[int] = Field(None) # here b: Optional[int] = Field(...) c: Optional[int] = Field(None, description="spam") d: Optional[int] = Field(None, description="spam") # here e: Optional[int] = Field(default=..., description="spam") f: Optional[int] = Field(default=None, description="spam")
I've added you as a co-author @brian-goo FYI. 🙏
None should be added if nothing was specified for
default
of Field if I understood correctly. This PR is to fix https://github.com/pydantic/bump-pydantic/issues/113 as well.Before:
After: