diff --git a/src/cfnlint/data/schemas/other/resources/configuration.json b/src/cfnlint/data/schemas/other/resources/configuration.json index 1cc9b6f64d..9de3ab7d26 100644 --- a/src/cfnlint/data/schemas/other/resources/configuration.json +++ b/src/cfnlint/data/schemas/other/resources/configuration.json @@ -60,11 +60,11 @@ ], "then": { "properties": { + "CreationPolicy": false, + "UpdatePolicy": false, "Version": { "type": "string" - }, - "CreationPolicy": false, - "UpdatePolicy": false + } } }, "type": "object" diff --git a/src/cfnlint/data/schemas/other/resources/metadata.json b/src/cfnlint/data/schemas/other/resources/metadata.json index 713ae1a5ac..d4d8acb3ef 100644 --- a/src/cfnlint/data/schemas/other/resources/metadata.json +++ b/src/cfnlint/data/schemas/other/resources/metadata.json @@ -1,12 +1,15 @@ { "additionalProperties": { - "type": ["object", "string"] + "type": [ + "object", + "string" + ] }, "properties": { "AWS::CloudFormation::Init": { - "type": "object", - "properties": {}, - "additionalProperties": true + "additionalProperties": true, + "properties": {}, + "type": "object" } }, "type": [ diff --git a/src/cfnlint/rules/resources/lmbd/SnapStart.py b/src/cfnlint/rules/resources/lmbd/SnapStart.py index 6de6f599e1..8a1f751cac 100644 --- a/src/cfnlint/rules/resources/lmbd/SnapStart.py +++ b/src/cfnlint/rules/resources/lmbd/SnapStart.py @@ -31,7 +31,7 @@ def validate(self, validator, _, instance, schema): if instance != "PublishedVersions": return - resource_name = validator.context.path[1] + resource_name = validator.context.path.path[1] lambda_version_type = "AWS::Lambda::Version" if list( validator.cfn.get_resource_children(resource_name, [lambda_version_type]) diff --git a/test/integration/test_schema_files.py b/test/integration/test_schema_files.py index aa68e394aa..d85c1dc8d2 100644 --- a/test/integration/test_schema_files.py +++ b/test/integration/test_schema_files.py @@ -37,6 +37,7 @@ class TestSchemaFiles(TestCase): "Outputs/*/Value", "Parameters", "Parameters/*", + "Resources", "Resources/*", "Resources/*/DeletionPolicy", "Resources/*/DependsOn", diff --git a/test/unit/rules/resources/lmbd/test_snapstart.py b/test/unit/rules/resources/lmbd/test_snapstart.py index 66cee2e750..d7889375a4 100644 --- a/test/unit/rules/resources/lmbd/test_snapstart.py +++ b/test/unit/rules/resources/lmbd/test_snapstart.py @@ -7,7 +7,7 @@ import pytest -from cfnlint.context import Context +from cfnlint.context import Context, Path from cfnlint.jsonschema import CfnTemplateValidator, ValidationError from cfnlint.rules.resources.lmbd.SnapStart import SnapStart from cfnlint.template import Template @@ -96,7 +96,18 @@ def validator(): def test_validate(name, instance, path, expected, rule, validator): validator = validator.evolve( context=Context( - path=path, + path=Path( + path=path, + cfn_path=deque( + [ + "Resources", + "AWS::Lambda::Function", + "Properties", + "SnapStart", + "ApplyOn", + ] + ), + ) ) ) errs = list(rule.validate(validator, "", instance, {}))