Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samtranslator/schema/any_cfn_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

constr = pydantic.constr

# Match anything not containing Serverless
# Anything goes if has string Type but is not AWS::Serverless::*
class Resource(LenientBaseModel):
Type: constr(regex=r"^((?!::Serverless::).)*$") # type: ignore
Type: constr(regex=r"^(?!AWS::Serverless::).+$") # type: ignore
2 changes: 1 addition & 1 deletion samtranslator/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5577,7 +5577,7 @@
"properties": {
"Type": {
"title": "Type",
"pattern": "^((?!::Serverless::).)*$",
"pattern": "^(?!AWS::Serverless::).+$",
"type": "string"
}
},
Expand Down
19 changes: 19 additions & 0 deletions tests/translator/input/schema_validation_3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Resources:
UnknownType1:
Type: AWS::Foo::Bar

UnknownType2:
Type: AWS::Foo::Bar
Properties:
Turtle: Train

UnknownType3:
Type: Foo::Bar::Egg
Properties:
Turtle: Train

UnknownType4:
Type: Foo::Bar::Egg

UnknownType5:
Type: Foo::Serverless::Egg
25 changes: 25 additions & 0 deletions tests/translator/output/aws-cn/schema_validation_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Resources": {
"UnknownType1": {
"Type": "AWS::Foo::Bar"
},
"UnknownType2": {
"Properties": {
"Turtle": "Train"
},
"Type": "AWS::Foo::Bar"
},
"UnknownType3": {
"Properties": {
"Turtle": "Train"
},
"Type": "Foo::Bar::Egg"
},
"UnknownType4": {
"Type": "Foo::Bar::Egg"
},
"UnknownType5": {
"Type": "Foo::Serverless::Egg"
}
}
}
25 changes: 25 additions & 0 deletions tests/translator/output/aws-us-gov/schema_validation_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Resources": {
"UnknownType1": {
"Type": "AWS::Foo::Bar"
},
"UnknownType2": {
"Properties": {
"Turtle": "Train"
},
"Type": "AWS::Foo::Bar"
},
"UnknownType3": {
"Properties": {
"Turtle": "Train"
},
"Type": "Foo::Bar::Egg"
},
"UnknownType4": {
"Type": "Foo::Bar::Egg"
},
"UnknownType5": {
"Type": "Foo::Serverless::Egg"
}
}
}
25 changes: 25 additions & 0 deletions tests/translator/output/schema_validation_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Resources": {
"UnknownType1": {
"Type": "AWS::Foo::Bar"
},
"UnknownType2": {
"Properties": {
"Turtle": "Train"
},
"Type": "AWS::Foo::Bar"
},
"UnknownType3": {
"Properties": {
"Turtle": "Train"
},
"Type": "Foo::Bar::Egg"
},
"UnknownType4": {
"Type": "Foo::Bar::Egg"
},
"UnknownType5": {
"Type": "Foo::Serverless::Egg"
}
}
}