Subclasses of dict (like `Label`) do not work with `camel_case=False`
haakonvt opened this issue · 4 comments
System information
- Python Version:
3.8.13
- SDK Version:
4.11.3
Describe the bug
Argument camel_case=False
for multiple Cognite classes that subclass dict
doesn't work because of declared properties with camelCase
names, e.g. Label
and ExtractionPipelineContact
.
To Reproduce
Runnable code reproducing the error.
>>> from cognite.client.data_classes import Label
>>> ll = Label(external_id="what-the-fox")
>>> ll.dump(camel_case=False)
{'externalId': 'what-the-fox'} # not snake cased
>>> ll.dump(camel_case=True)
{'externalId': 'what-the-fox'}
Or (notice sendNotification
always in camel case):
>>> from cognite.client.data_classes import ExtractionPipelineContact
>>> epc = ExtractionPipelineContact(name="Fox", email="NA", role="Singer", send_notification=False)
>>> epc.dump(camel_case=False)
{'name': 'Fox', 'email': 'NA', 'role': 'Singer', 'sendNotification': False}
>>> epc.dump(camel_case=True)
{'name': 'Fox', 'email': 'NA', 'role': 'Singer', 'sendNotification': False}
List of affected:
AggregateResult(dict)
AggregateResultItem(dict)
AssetAggregate(dict)
BoundingBox3D(dict)
DataSetAggregate(dict)
EndTimeFilter(dict)
ExtractionPipelineContact(dict)
FileAggregate(dict)
GeoLocation(dict)
GeoLocationFilter(dict)
Geometry(dict)
GeometryFilter(dict)
Label(dict)
LabelFilter(dict, CogniteFilter)
RevisionCameraProperties(dict)
SequenceAggregate(dict)
TimeSeriesAggregate(dict)
TimestampRange(dict)
I took a look at the affected classes. And only around a quarter of them have dump()
method. As I understand, if the dump method is absent there is not thing to be done there.
I took a look at the affected classes. And only around a quarter of them have
dump()
method. As I understand, if the dump method is absent there is not thing to be done there.
Maybe these shouldn't have a dump method? Would be a nice investigation if we could just remove them