MPT-15233 Fix for snake-case to camel-case conversion#107
Conversation
albertsola
commented
Nov 6, 2025
- Disabled camel_killer_box
- Renamed Model._resource_data to Model._box for better naming clarity
- Added models representation
✅ Found Jira issue key in the title: MPT-15233 |
- Disabled camel_killer_box - Renamed Model._resource_data to Model._box for better naming clarity - Added models representation
0c9bb4d to
d13d35c
Compare
| def test_case_conversion(): | ||
| resource_data = {"id": "abc-123", "FullName": "Alice Smith"} | ||
|
|
||
| resource = Model(resource_data) | ||
|
|
||
| assert resource.FullName == "Alice Smith" | ||
| assert resource.to_dict() == resource_data | ||
| with pytest.raises(AttributeError): | ||
| resource.full_name # noqa: B018 | ||
|
|
There was a problem hiding this comment.
@d3rky @ruben-sebrango @svazquezco @robcsegal
can we review this is the expected behaviour?
| assert resource.FullName == "Alice Smith" | ||
| assert resource.to_dict() == resource_data | ||
| with pytest.raises(AttributeError): | ||
| resource.full_name # noqa: B018 |
|
|
||
| class Model: | ||
| class MptBox(Box): | ||
| """python-box that preserves camelCase keys when converted to json.""" |
There was a problem hiding this comment.
I would also describe here that the key_mapping keyword is reserved for now
|
|
||
| assert resource.full_name == "Alice Smith" | ||
| assert resource.to_dict() == resource_data | ||
| with pytest.raises(AttributeError): |
There was a problem hiding this comment.
Honestly speaking I would split it to two functions, just because you are checking here different things --> key-access and to_dict method
| assert resource.to_dict() == expected_resource_data | ||
|
|
||
| with pytest.raises(AttributeError): | ||
| _ = resource.contact.FullName # noqa: WPS122 |
There was a problem hiding this comment.
You don't need this ignore now :-)
- Disabled camel_killer_box - Renamed Model._resource_data to Model._box for better naming clarity - Added models representation
b1cb96d to
c0f6b5f
Compare
|
…ing-must-not-be-converted-to-snake-case-when-calling-to_dict' into MPT-15233/API-client-payload-casing-must-not-be-converted-to-snake-case-when-calling-to_dict
|
This is a draft PR, I have substantial WIP changes to push. |



