Skip to content

Feat allow dict values in generate event cmd#7938

Merged
seshubaws merged 11 commits intoaws:developfrom
lvthillo:feat-allow-dict-values-in-generate-event-cmd
Jan 22, 2026
Merged

Feat allow dict values in generate event cmd#7938
seshubaws merged 11 commits intoaws:developfrom
lvthillo:feat-allow-dict-values-in-generate-event-cmd

Conversation

@lvthillo
Copy link
Copy Markdown
Contributor

@lvthillo lvthillo commented Mar 17, 2025

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

  • Add input/output type hints to new functions/methods
  • Write design document if needed (Do I need to write a design document?)
  • Write/update unit tests
  • Write/update integration tests
  • Write/update functional tests if needed
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Mar 17, 2025
@lvthillo lvthillo marked this pull request as ready for review November 29, 2025 12:19
@lvthillo lvthillo requested a review from a team as a code owner November 29, 2025 12:19
@vicheey
Copy link
Copy Markdown
Contributor

vicheey commented Dec 8, 2025

Thank you for your contribution. Let me take look and do some test.

seshubaws
seshubaws previously approved these changes Jan 21, 2026
@seshubaws seshubaws enabled auto-merge January 22, 2026 20:34
@seshubaws seshubaws added this pull request to the merge queue Jan 22, 2026
Merged via the queue into aws:develop with commit 27ba438 Jan 22, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants