From 312a835c126134bb330063e58ee42b901db883ec Mon Sep 17 00:00:00 2001 From: Kevin DeJong Date: Wed, 10 Jul 2024 09:09:18 -0700 Subject: [PATCH] Force resolve validation to not use strict types --- src/cfnlint/rules/functions/_BaseFn.py | 5 +++++ test/unit/rules/functions/test_basefn.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/cfnlint/rules/functions/_BaseFn.py b/src/cfnlint/rules/functions/_BaseFn.py index 2e4e118997..99dce4adf4 100644 --- a/src/cfnlint/rules/functions/_BaseFn.py +++ b/src/cfnlint/rules/functions/_BaseFn.py @@ -63,6 +63,11 @@ def resolve( key, _ = self.key_value(instance) return_err: ValidationError | None = None + validator = validator.evolve( + context=validator.context.evolve( + strict_types=False, + ), + ) for value, v, resolve_err in validator.resolve_value(instance): if resolve_err: yield resolve_err diff --git a/test/unit/rules/functions/test_basefn.py b/test/unit/rules/functions/test_basefn.py index a4dc9dabf3..3cfbdc4783 100644 --- a/test/unit/rules/functions/test_basefn.py +++ b/test/unit/rules/functions/test_basefn.py @@ -27,6 +27,12 @@ def rule(): [], ), ("Everything is fine", {"Fn::Sub": "Foo"}, {"enum": ["Foo"]}, []), + ( + "Resolved Fn::Sub has no strict type validation", + {"Fn::Sub": "2"}, + {"type": ["integer"]}, + [], + ), ( "Standard error", {"Fn::Sub": "Bar"},