-
Notifications
You must be signed in to change notification settings - Fork 6
[Fix] Leave empty objects in metadata #213
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
base: release_2.3.x
Are you sure you want to change the base?
Conversation
Some manual testing logs snippets. In this case I created a shadow document and then set a field to null to remove it. For the case of removing a simple value node (aka JSON value) the shadow document is updated to
Now for the case of removing a child key-value pair, it is shown that the parent structure maintains.
|
544b063
to
3eed2d8
Compare
bc594e6
to
4338bc3
Compare
Unit Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against c62b7d2 |
Integration Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against c62b7d2 |
By removing empty objects from the metadata we are setting the ShadowDocMetadata field to null which results in a later NullPointerException when building the updated metadata. issue - #212
4338bc3
to
2c3e293
Compare
This isn't MISRA C - this ordering is preferred
Updates have happened since review.
Some notes from manual testing I performed. There were 4 tests cases I tried - they were executed serially to build off each other. Test cases 2-4 are also covered by unit tests now.
I added a few logs to the shadow manager to help me verify this but the logs below should be fairly explanatory. I logged at warn to ease finding the logs:
For the desired values I added the following logs here. The reported logs are similar.
|
Issue #, if available:
#212
Description of changes:
This change updates how Shadow document metadata is calculated. For a simple document updates which remove only top key value pairs, the behavior will not change. For a more complicated document where nested objects are removed, the behavior is updated to keep the empty parent object (which matches IoT Shadow).
Why is this change necessary:
By removing empty objects from the metadata the shadow manager is calculating the ShadowDocMetadata.desired (or reported) field to null which results in a later NullPointerException when building the updated metadata later.
How was this change tested:
Added unit tests as well as performed manual testing against the case mentioned in the issue.
Any additional information or context required to review the change:
It's useful to know how Jackson JsonNode's function
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.