-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X
Description
According to the documentation:
Typically, .json() in turn calls .dict() and serialises its result.
This behavior has been changed in 1.9.0, and calling .json() doesn't call .dict() anymore.
I consider this a breaking change because it breaks a documented feature. Also, the documentation hasn't been updated to reflect this change.
Checks
- I added a descriptive title to this issue
- I have searched (google, github) for similar issues and couldn't find anything
- I have read and followed the docs and still think this is a bug
Bug
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
1.9.0
import pydantic
class MyModel(pydantic.BaseModel):
spam: int
def dict(self, **kwargs):
d = super().dict(**kwargs)
d["ham"] = 2
return d
MyModel(spam=1).json()
# expect to get: {"spam": 1, "ham": 2}
# actually get: {"spam": 1}dsix-work, Ran4, janwytze, bernoreitsma and KlaasJelmer
Metadata
Metadata
Assignees
Labels
bug V1Bug related to Pydantic V1.XBug related to Pydantic V1.X