You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Pydantic support is limited to types supported by json.dumps()
To Reproduce
Steps to reproduce the behavior:
Just use a BaseModel
as
classWithDate(pydantic.BaseModel):
when : datetime
as Body in a request
it will fail because BaseModel.dict() will return {"when": datetime(...)} which the call to json.dumps() inicide of requests won't be able to handle.
Before uplink added support for pydantic I had a working implementation that was preaty similar to the one we have now, but instead of using mode.dict() I used `json.loads(model.json()), that's not the best way, but is the easier one until this get solved somehow: pydantic/pydantic#1409
The text was updated successfully, but these errors were encountered:
I'll make a pr to implement this without the dumpsjson "dance" by using a visitor, so we can use that until they provide a propper API for it on pydantic.
Describe the bug
Pydantic support is limited to types supported by
json.dumps()
To Reproduce
Steps to reproduce the behavior:
Just use a
BaseModel
as
as
Body
in a requestit will fail because
BaseModel.dict()
will return{"when": datetime(...)}
which the call tojson.dumps()
inicide ofrequests
won't be able to handle.Before uplink added support for
pydantic
I had a working implementation that was preaty similar to the one we have now, but instead of usingmode.dict()
I used `json.loads(model.json()), that's not the best way, but is the easier one until this get solved somehow:pydantic/pydantic#1409
The text was updated successfully, but these errors were encountered: