docs: fix map operation examples to return JSON-serializable dict#309
Closed
docs: fix map operation examples to return JSON-serializable dict#309
Conversation
Fix issue aws#301: Map operation examples were returning BatchResult directly, which is not JSON serializable and causes Lambda to fail. Changes: - Update all handler return types from BatchResult[T] to dict - Add .to_dict() calls to convert BatchResult before returning - Add explanatory comments about JSON serialization requirement - Update "Getting started" description to reflect dict return type - Keep one example showing how to extract and filter results Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
yaythomas
approved these changes
Feb 20, 2026
Member
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.
Summary
Fixes #301
The map operation documentation examples were returning
BatchResultdirectly from Lambda handlers. SinceBatchResultis not JSON serializable, these examples would cause Lambda to fail at runtime with serialization errors.Changes
BatchResult[T]todict.to_dict()calls to convertBatchResultbefore returningcheck_inventory) showing how to extract and transform results fromBatchResultbefore returningBefore
After
Test plan
dicttype.to_dict()forBatchResultconversioncontext.map()returnsBatchResult[T]) is unchanged (correct behavior)Generated with Claude Code