-
Notifications
You must be signed in to change notification settings - Fork 0
MPT-15233 Fix for snake-case to camel-case conversion #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| class Model: | ||
| class MptBox(Box): | ||
| """python-box that preserves camelCase keys when converted to json.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |



