Skip to content

Update protocol tests and handle null values in sparse map serialization#10177

Open
AndrewAsseily wants to merge 4 commits intov2from
update-protocol-tests-03-30
Open

Update protocol tests and handle null values in sparse map serialization#10177
AndrewAsseily wants to merge 4 commits intov2from
update-protocol-tests-03-30

Conversation

@AndrewAsseily
Copy link
Copy Markdown
Contributor

Description of changes:

PR #10110 added null handling for lists but not maps. This PR extends the same pattern to maps. Also fixes the CBOR map parser which was silently dropping null values instead of preserving them.

Also updates protocol tests to the latest.

tests/unit/botocore/test_protocols.py ......................................................................................................................................................................................................................... [ 22%]
............................................................................................................................................................................................................................................................... [ 49%]
............................................................................................................................................................................................................................................................... [ 76%]
...............................................................................................................................................................................................................................                                 [100%]

========================================================================================================================= 950 passed in 1.77s =========================================================================================================================

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AndrewAsseily AndrewAsseily requested a review from a team April 1, 2026 14:49
@aemous aemous added the v2 label Apr 6, 2026
@ashovlin ashovlin self-assigned this Apr 17, 2026
@AndrewAsseily AndrewAsseily requested a review from ashovlin April 20, 2026 18:46
Copy link
Copy Markdown
Member

@ashovlin ashovlin left a comment

Choose a reason for hiding this comment

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

  1. Can you add a changelog entry?
  2. I see only the JSON and CBOR serializers are updated - do the rest handle nulls already?
  3. Preferably in protocol-tests-ignore-list.json, but at least in the PR description - can you write why we're skipping each new skipped case? Do we want to preserve backwards compatibility, or do we have bugs that we're not addressing yet?

@AndrewAsseily
Copy link
Copy Markdown
Contributor Author

AndrewAsseily commented Apr 22, 2026

  1. Added in revision

The other serializers don't handle nulls, they'd crash the same way. The original sparse work (PR #10110) only targeted parsing, not serialization. This PR adds null handling to the JSON and CBOR serializers because those are the only protocols with sparse test cases. I checked the service models and the only service with the sparse trait today is connectcases, which uses REST-JSON

That said, services could add sparse at any time, so it might be worth adding to the remaining serializers in this PR to be safe. Let me know what you think.

  1. Ignore list
  • XmlAttributesInMiddle: Backwards compatibility: Same issue as the already-ignored XmlAttributesOnPayload.

  • RestJsonHttpPayloadWithStructureAndEmptyResponseBody: Backwards compatibility: Changing this could break customers accessing keys on the result without a None check.

  • QueryEmptyInputAndEmptyOutput / QueryNoInputAndOutput: Bug: The parser crashes with KeyError when the result wrapper element is missing from the response body. Should handle this gracefully.

@AndrewAsseily AndrewAsseily requested a review from ashovlin April 23, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants