fix(validate): pin cfn-lint below the release that drops the SAM transform - #9249
Merged
Conversation
roger-zhangg
force-pushed
the
fix-cfn-lint-sam-resource-types
branch
from
September 3, 2026 22:26
e891fea to
ea55725
Compare
valerena
previously approved these changes
Sep 3, 2026
…sform cfn-lint 1.54.0 removed its dependency on the SAM transform and started validating AWS::Serverless resources against schemas it bundles itself. It has no schema for four of the resource types aws-sam-translator supports, so `sam validate --lint` fails a valid template with E3006 'Resource type ... does not exist': AWS::Serverless::CapacityProvider AWS::Serverless::MicrovmImage AWS::Serverless::NetworkConnector AWS::Serverless::WebSocketApi Reported upstream as aws-cloudformation/cfn-lint#4678; pin back to <1.54 until it is fixed. The floor moves to 1.52.0 because earlier versions have no schema for the resources the transform generates for MicrovmImage and NetworkConnector, so they cannot lint those templates either. Add a unit test that lints one of every SAM resource type, so a dependency bump that reintroduces this fails before merge. It fails if SAM gains a resource type the template does not cover.
roger-zhangg
force-pushed
the
fix-cfn-lint-sam-resource-types
branch
from
September 3, 2026 23:01
ea55725 to
2930633
Compare
valerena
approved these changes
Sep 3, 2026
vicheey
approved these changes
Sep 3, 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?
Regression in 1.166.0, from #9156. Reported upstream as aws-cloudformation/cfn-lint#4678.
Why is this change necessary?
cfn-lint 1.54.0 dropped its
aws-sam-translatordependency and started validatingAWS::Serverlessresources against schemas it bundles itself (cfn-lint#4491). Itsproviders/sam.jsoncovers 9 of the 13 resource typesaws-sam-translatorsupports, sosam validate --lintnow fails valid templates:Affected:
CapacityProvider,MicrovmImage,NetworkConnector,WebSocketApi. All four are documented SAM resource types with their own translator schema modules. Bisected to cfn-lint 1.54.0 (1.53.3 clean), still present in 1.56.0 and on cfn-lintmain. Reproduces with plaincfn-lint, so it is not specific to SAM CLI.This broke CI for templates using these types, for example aws-lambda-web-adapter, which went from passing on SAM CLI 1.165.0 to failing on 1.166.0 with no template change.
How does it address the issue?
Pins
cfn-lint>=1.52.0,<1.54until upstream ships the missing schemas.The upper bound excludes the releases described above. The lower bound moves up from 1.51.3 because 1.51.x has no schema for the
AWS::Lambda::MicrovmImageandAWS::Lambda::NetworkConnectorresources the transform generates, so it cannot lint those templates either — the pin now brackets exactly the versions that handle every SAM resource type.Adds a unit test that lints one of every SAM resource type, in
tests/unit/commands/validate/test_lint_sam_resource_types.py. It runs on every PR, so a dependency bump that reintroduces this fails before merge, and it reaches cfn-lint throughcfnlint.api.lint— the same entry pointvalidate._lintuses.The covered types are asserted equal to what
aws-sam-translatorexposes, so the test fails if SAM gains a resource type the template does not cover. All 13 are covered today:Api,Application,CapacityProvider,Connector,Function,GraphQLApi,HttpApi,LayerVersion,MicrovmImage,NetworkConnector,SimpleTable,StateMachine,WebSocketApi.Verified it passes on cfn-lint 1.52.0, 1.52.1, 1.53.0 and 1.53.3, and fails on 1.54.0, 1.55.0, 1.55.1 and 1.56.0 naming all four broken types.
What side effects does this change have?
cfn-lint stays on 1.53.x until cfn-lint#4678 is resolved, so Dependabot bumps in the
cfn-lintgroup will fail the new unit test until then. That is the intended signal.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.