This pull request introduces a change to the serialize function in smartsheet/util.py to ensure that the additionalDetails property is correctly serialized when present in the response for the Event Reporting API.
Changes:
Code Changes:
Added an elif isinstance(obj, dict) statement in the serialize function to handle dictionary objects. This ensures that properties like additionalDetails, which are dictionaries with an unknown number/type of key:value pairs, are correctly serialized and included in the output.
Test Changes:
Updated the integration test test_list_events in tests/integration/test_events.py to include a check for the additionalDetails field. This test now verifies that when additionalDetails is present, it is correctly populated and is of type dict.
Reason for Change:
The additionalDetails property was missing when querying Event Reporting. By adding the elif isinstance(obj, dict) statement, we ensure that dictionary properties are handled properly during the serialization process, preserving the integrity of the API response.
Testing:
Ran a small script to query the Event Reporting API and verify that the additionalDetails field is correctly serialized and populated when present in the response (sample outputs below).
Ran all mock and integration tests locally
Before this change the test results were: 8 failed, 340 passed, 10 skipped, 1 xpassed, 89 warnings, 16 rerun
After this change (and adding the additional test), the test results were identical - none of the failures appear to be related to Event Reporting or serialization
It should be noted that a number of the serialization mock tests were skipped due to the mock API not being updated, and also there doesn't appear to be any mock tests for Events.
Description:
This pull request introduces a change to the
serialize
function insmartsheet/util.py
to ensure that theadditionalDetails
property is correctly serialized when present in the response for the Event Reporting API.Changes:
Code Changes:
elif isinstance(obj, dict)
statement in theserialize
function to handle dictionary objects. This ensures that properties likeadditionalDetails
, which are dictionaries with an unknown number/type of key:value pairs, are correctly serialized and included in the output.Test Changes:
test_list_events
intests/integration/test_events.py
to include a check for theadditionalDetails
field. This test now verifies that whenadditionalDetails
is present, it is correctly populated and is of typedict
.Reason for Change:
The
additionalDetails
property was missing when querying Event Reporting. By adding theelif isinstance(obj, dict)
statement, we ensure that dictionary properties are handled properly during the serialization process, preserving the integrity of the API response.Testing:
additionalDetails
field is correctly serialized and populated when present in the response (sample outputs below).Sample output:
Without handling dicts during serialization:
With change to serialize dicts:
Note: I believe this supersedes Salman's PR here -
additionalDetails
is still empty when querying when I tested with his change.