Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion slack_sdk/scim/v1/internal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _convert_dict_keys(
)
result_dict[new_key].append(new_element)
else:
result_dict[new_key].append(_create_copy(original_value))
result_dict[new_key].append(_create_copy(element))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Great find! Appending the element instead of the whole list fixes schemas without touching the list-of-dicts branch, and the test pins both shapes.

else:
result_dict[new_key] = _create_copy(original_value)
return result_dict
Expand Down
6 changes: 6 additions & 0 deletions tests/slack_sdk/scim/test_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ def test_snake_cased(self):
result = _to_snake_cased(json.loads(response_body))
self.assertEqual(result["start_index"], 1)
self.assertIsNotNone(result["resources"][0]["id"])

def test_snake_cased_list_of_strings(self):
body = {"schemas": ["urn:a", "urn:b"], "emails": [{"primaryValue": "x"}]}
result = _to_snake_cased(body)
self.assertEqual(result["schemas"], ["urn:a", "urn:b"])
self.assertEqual(result["emails"], [{"primary_value": "x"}])