Repository navigation
fix: Allow object form of CodeUri in SAM Globals.Function - #4741
Merged
kddejong merged 2 commits intoOct 20, 2026
Merged
Conversation
Globals.Function.CodeUri was typed as string in globals.json, so E3724 rejected the Bucket/Key/Version object form that AWS::Serverless::Function.CodeUri and the SAM translator accept. Accept a string or an object with the same keys as the resource schema's CodeUri definition (Bucket, Key, StorageMode, Version). Bucket/Key are not required at the Globals level because SAM merges Globals dicts into the resource property; the merged resource property is still validated against the resource schema. Fixes aws-cloudformation#4739
kddejong
approved these changes
Oct 20, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4741 +/- ##
=======================================
Coverage 94.72% 94.72%
=======================================
Files 439 439
Lines 15858 15858
Branches 3067 3067
=======================================
Hits 15021 15021
Misses 457 457
Partials 380 380
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Issue #, if available: #4739
Description of changes:
Globals.Function.CodeUriwas typed asstringinsrc/cfnlint/data/schemas/other/sam/globals.json, so E3724 rejected theBucket/Key/Versionobject form thatAWS::Serverless::Function.CodeUriand the SAM translator accept. This is a regression since 1.54.0, when globals.json was introduced in #4491.Function.CodeUriin globals.json now accepts a string or an object with the same keys as the resource schema'sCodeUridefinition (Bucket,Key,StorageMode,Version), withadditionalProperties: falseso typos are still reported.required(Bucket,Key) is intentionally omitted from the Globals schema. Globals are merged into each resource'sCodeUribefore validation (_sam_globals._merge), so Globals may supply only some keys and the resource the rest. The resource-level schema still enforces bothBucketandKeyon the merged result (E3003).Versionand intrinsics), the string form, an intrinsicCodeUri, and an unknown key.I compared every typed property in globals.json against the corresponding
AWS::Serverless::*resource schema;Function.CodeUriwas the only one narrower than the resource property.The reproduction template from the issue previously reported
E3724 {'Bucket': 'my-bucket', 'Key': 'code.zip'} is not of type 'string'and now lints clean.Fixes #4739
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.