fix(projection): preserve nested structure through intermediate list indices#33
Open
pdf-amzn wants to merge 1 commit into
Open
fix(projection): preserve nested structure through intermediate list indices#33pdf-amzn wants to merge 1 commit into
pdf-amzn wants to merge 1 commit into
Conversation
…indices
When projecting a path like a.b[0].c, the intermediate list index
handler was returning early with just the leaf value wrapped in a list,
producing {"a": {"b": ["target"]}}. The correct DynamoDB behavior
is to preserve the nested map structure after the list index, producing
{"a": {"b": [{"c": "target"}]}}.
Add build_remaining_structure() helper that recursively builds the
nested attribute/list structure for all path elements after the
intermediate list index before wrapping in the single-element list.
Verified against real DynamoDB: GetItem with ProjectionExpression
'a.b[0].c' returns the map wrapper around 'c'.
Fixes review concern #15.
jcshepherd
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When projecting a path like a.b[0].c, the intermediate list index
handler was returning early with just the leaf value wrapped in a list,
producing {"a": {"b": ["target"]}}. The correct DynamoDB behavior
is to preserve the nested map structure after the list index, producing
{"a": {"b": [{"c": "target"}]}}.
Add build_remaining_structure() helper that recursively builds the
nested attribute/list structure for all path elements after the
intermediate list index before wrapping in the single-element list.
Verified against real DynamoDB: GetItem with ProjectionExpression
'a.b[0].c' returns the map wrapper around 'c'.