Skip to content

Commit d23f981

Browse files
committed
fix: assert basepath list outside of loop
1 parent 10eb1ad commit d23f981

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

samtranslator/model/api/api_generator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,13 @@ def _construct_api_domain( # noqa: PLR0912, PLR0915
554554
basepath_mapping = self._create_basepath_mapping(api_domain_name, rest_api, None, None)
555555
basepath_resource_list.extend([basepath_mapping])
556556
else:
557+
if not is_intrinsic(basepaths[0]):
558+
sam_expect(basepaths, self.logical_id, "Domain.BasePath").to_be_a_list_of(ExpectedType.STRING)
557559
for basepath in basepaths:
558560
if is_intrinsic(basepath):
559561
mapping_basepath = basepath
560562
logical_id = self.logical_id + "BasePathMapping"
561563
else:
562-
sam_expect(basepaths, self.logical_id, "Domain.BasePath").to_be_a_list_of(ExpectedType.STRING)
563564
# Remove possible leading and trailing '/' because a base path may only
564565
# contain letters, numbers, and one of "$-_.+!*'()"
565566
path = "".join(e for e in basepath if e.isalnum())

0 commit comments

Comments
 (0)