Repository navigation
fix(scim): keep list-of-strings values flat when converting response keys - #2041
pcbeingused333 wants to merge 4 commits into
Conversation
|
Thanks for the contribution! Before we can merge this, we need @pcbeingused333 to sign the Salesforce Inc. Contributor License Agreement. |
mwbrooks
left a comment
There was a problem hiding this comment.
✅ Thanks @pcbeingused333! 🎉 Congrats on your first contribution to python-slack-sdk!
| 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)) |
There was a problem hiding this comment.
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.
|
@pcbeingused333 Could you sign the Salesforce CLA? We need it signed before we can continue with this PR. 🙏 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2041 +/- ##
==========================================
+ Coverage 84.69% 84.71% +0.02%
==========================================
Files 118 118
Lines 14116 14116
==========================================
+ Hits 11955 11959 +4
+ Misses 2161 2157 -4 ☔ View full report in Codecov by Harness. |
Summary
SCIM responses with list-of-string fields (for example
schemas) came back nested after the snake_case key conversion, souser.schemasfrom read/search/create/patch user responses was[["urn:a", "urn:b"], ["urn:a", "urn:b"]]instead of["urn:a", "urn:b"]. No related issue.Root cause: in
_convert_dict_keys(slack_sdk/scim/v1/internal_utils.py), the branch for lists whose first element is not a dict appended_create_copy(original_value)(the whole list) once per element. The fix appends_create_copy(element). Lists of dicts such asemailstake the other branch and are unchanged.Testing
python -m pytest tests/slack_sdk/scim -q. The newtest_snake_cased_list_of_stringsintests/slack_sdk/scim/test_internals.pyfails before the change and passes after it.Category
/docs(Documents)/tutorial(PythOnBoardingBot tutorial)tests/integration_tests(Automated tests for this library)Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.This change was prepared with the help of an AI coding assistant (Claude) and submitted by a human contributor.