Remove SAM translator dependency, validate SAM templates via schemas - #4491
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4491 +/- ##
==========================================
- Coverage 94.48% 94.44% -0.04%
==========================================
Files 430 432 +2
Lines 15190 15214 +24
Branches 2921 2929 +8
==========================================
+ Hits 14352 14369 +17
- Misses 459 463 +4
- Partials 379 382 +3
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:
|
fdb75ab to
aefb4dc
Compare
aefb4dc to
054499d
Compare
d0b4e98 to
ca2ffa8
Compare
5e771ed to
3ca222c
Compare
3ca222c to
c1cc597
Compare
Replace the aws-sam-translator runtime dependency with direct JSON Schema validation of SAM resource types. SAM templates are now validated against schemas from the enhanced schemas service using the same provider schema infrastructure as CloudFormation resources. - Remove _sam.py transform module and aws-sam-translator dependency - Add _sam_globals.py to merge Globals section into SAM resources - Add E3724 rule for Globals section validation - Add E3066 rule for SAM resource attributes (Connectors, IgnoreGlobals) - Extend Lambda rules to also match AWS::Serverless::Function paths - Treat SAM resources as module-like for sub-resource Ref/GetAtt wildcard - Handle unresolvable schema pointers gracefully in GetAtt validation - Inject SAM implicit resources (roles, versions, aliases, stages, etc.) Fixes aws-cloudformation#4556
c1cc597 to
6409d21
Compare
|
@kddejong I think this has broken something. 1.54.0 now reports |
|
@paul-uz Thanks for reporting this. I've tracked it in #4606. The issue is that Workaround: Move Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Description: "Your description here" # ✅ Correct location
Runtime: python3.12
...cfn-lint 1.54 is flagging this as an error, but since the template does technically deploy (just with the field silently ignored), we'll look at downgrading this to a warning for SAM resources. |
Extend E3043 (NestedStackParameters) to also validate AWS::Serverless::Application resources with local template references. After PR #4491 removed the SAM translator, these resources persist unexpanded and were no longer validated. Changes: - Add AWS::Serverless::Application to resource_property_types - Handle Location property (local path, S3 URL, or SAR dict) - Skip validation for remote URLs and SAR references - Add type hints and refactor validation into shared method Fixes #4612
Summary
Replace the
aws-sam-translatorruntime dependency with direct JSON Schema validation of SAM resource types. SAM templates are now validated against schemas from the enhanced schemas service, using the same provider schema infrastructure as CloudFormation resources.Changes
_sam.pytransform module andaws-sam-translatordependency_sam_globals.pyto merge Globals section properties into SAM resourcesAWS::Serverless::FunctionpathsBehavioral Notes
!Ref MyFunctionRoleand!GetAtt MyFunction.Arnpass via the wildcard mechanismTesting
Fixes #4556