diff --git a/samtranslator/model/__init__.py b/samtranslator/model/__init__.py index 61d9d7c2d..e283462d7 100644 --- a/samtranslator/model/__init__.py +++ b/samtranslator/model/__init__.py @@ -5,7 +5,7 @@ from samtranslator.intrinsics.resolver import IntrinsicsResolver from samtranslator.model.exceptions import InvalidResourceException -from samtranslator.model.types import Validator +from samtranslator.model.types import Validator, any_type from samtranslator.plugins import LifeCycleEvents from samtranslator.model.tags.resource_tagging import get_tag_list @@ -45,6 +45,17 @@ def __init__(self, required: bool, validate: Validator) -> None: super().__init__(required, validate, False) +class PassThroughProperty(PropertyType): + """ + Pass-through property. + + SAM Translator should not try to read the value other than passing it to underlaying CFN resources. + """ + + def __init__(self, required: bool) -> None: + super().__init__(required, any_type(), False) + + class Resource(object): """A Resource object represents an abstract entity that contains a Type and a Properties object. They map well to CloudFormation resources as well sub-types like AWS::Lambda::Function or `Events` section of diff --git a/samtranslator/model/sam_resources.py b/samtranslator/model/sam_resources.py index 7023e717a..6e00809d1 100644 --- a/samtranslator/model/sam_resources.py +++ b/samtranslator/model/sam_resources.py @@ -31,7 +31,7 @@ from samtranslator.metrics.method_decorator import cw_timer from samtranslator.model import ( ResourceResolver, - Property, + PassThroughProperty, PropertyType, SamResourceMacro, Resource, @@ -1283,7 +1283,7 @@ class SamHttpApi(SamResourceMacro): # In the future, we might rename and expose this property to customers so they can have SAM manage Explicit APIs # Swagger. "__MANAGE_SWAGGER": PropertyType(False, is_type(bool)), - "Name": Property(False, any_type()), + "Name": PassThroughProperty(False), "StageName": PropertyType(False, one_of(is_str(), is_type(dict))), "Tags": PropertyType(False, is_type(dict)), "DefinitionBody": PropertyType(False, is_type(dict)),