[BUG][Python] client's from_dict
and to_dict
set optional but non-nullable fields to None
#18394
Labels
from_dict
and to_dict
set optional but non-nullable fields to None
#18394
The python client's
from_dict
sets optional but non-nullable fields toNone
.My spec defines
MyObject
like this:The
retentionTimeInDays
property is optional (not required) but not nullable. The expectation is that the property doesn't have to exist but if it does it cannot benull
.The generated Pydantic class's
from_dict
method however sets theretentionTimeInDays
property toNone
if it's not present in the dict:It behaves the same way when dumping
to_dict
:In my case I want to save the payload for my endpoint in a file without the
retentionTimeInDays
property since it's optional. I load the file with thefrom_dict
method which putsNone
forretentionTimeInDays
. The server correctly validates that this property cannot benull
if present and fails 400.I'd like to check with you if you as well consider this wrong behaviour before digging deeper.
What do you think?
The text was updated successfully, but these errors were encountered: