-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I currently have an entity which has a one to one relationship with another entity which is nullable.
When I retrieve the entity from the database while there is no foreign key value set, the result for that particular key/value is obviously None. When you then call to_json on the entity, this None value results in null in the resulting json. So far so good and understandable. (All though it would be nice to have an option to omit these null key/values completely, which I actually need in my case but that's a whole other thing).
What I would expect is that if I then do a new_from_json or update_from_json with this exact same json (with the null values), that this would work? (I have a REST API, client retrieves an entity, updates one property and passes back the entire object).
But this fails stating: 'NoneType' object is not iterable and only when I delete the entire key containing the null value it works. I think it would be nice that serialisation/deserialisation would be idempotent, meaning it should accept back what it outputs? Or I'm I overlooking something?