Feat allow dict values in generate event cmd#7938
Merged
seshubaws merged 11 commits intoaws:developfrom Jan 22, 2026
Merged
Conversation
Contributor
|
Thank you for your contribution. Let me take look and do some test. |
seshubaws
previously approved these changes
Jan 21, 2026
seshubaws
reviewed
Jan 21, 2026
vicheey
reviewed
Jan 21, 2026
tests/unit/commands/local/generate_event/test_event_generation.py
Outdated
Show resolved
Hide resolved
seshubaws
approved these changes
Jan 22, 2026
vicheey
approved these changes
Jan 22, 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.
Which issue(s) does this change fix?
#1877
Why is this change necessary?
sam local generate-event only supports string values for parameters. When you need to pass complex data structures like queryStringParameters for API Gateway events, you have to manually edit the generated JSON file afterward.
How does it address the issue?
The implementation uses a placeholder strategy to safely handle dictionary values. Before template rendering, dict-type parameters are replaced with unique placeholders to avoid JSON escaping issues. After Chevron renders the template, the placeholders are replaced with actual parsed dictionary objects. This allows users to pass JSON strings via CLI that get converted to proper dict objects in the final event output.
What side effects does this change have?
This change is fully backward compatible with no breaking changes. Existing string parameters continue to work unchanged. The only side effect is a minor performance overhead from parsing JSON strings, which is negligible. Invalid JSON strings are silently kept as strings rather than throwing errors, which could potentially mask user input mistakes but maintains compatibility.
Mandatory Checklist
PRs will only be reviewed after checklist is complete
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.