MediaMath/t1-python

Support for deleting fields from entities

Closed this issue · 4 comments

FodT commented

It is not currently possible to remove numerical (and likely other) fields from entities and then save that change.
The API expects a blank key/value pair when removing an optional field which has previously been set - setting a numerical field to None fails validation.

Could implement a .removeField() entity function?

How does JSON Schema/t1-node handle this? If you want to remove a concept ID, do you just set it to null? Is that possible there without additional work?

FodT commented

That's a good catch. setting numerical fields to null will cause a jsonschema validation exception to be thrown, so we need to think about this there, too. I suspect the easiest thing would be to declare all fields as {"type": [actual_type, "null"]}, which jsonschema allows.

FodT commented

with #130, we might be able to introduce a delete_field(fieldname) which bypasses the validation checks. Thoughts?

FodT commented

#167 fixes del Entity.field to post a blank value on Entity.save()