MediaMath / t1-python

Python SDK for MediaMath Platform APIs
https://developer.mediamath.com/
Apache License 2.0
18 stars 28 forks source link

Support for deleting fields from entities #83

Closed FodT closed 6 years ago

FodT commented 8 years ago

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?

pswaminathan commented 8 years ago

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 8 years ago

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 7 years ago

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

FodT commented 6 years ago

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