Skip to content

Commit be312b9

Browse files
author
Rondineli
committed
new approach to not cause KeyErrors
1 parent b3ce527 commit be312b9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

samtranslator/swagger/swagger.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -807,16 +807,16 @@ def add_request_validator_to_method(self, path, method_name, validate_body=False
807807
# Adding only if the validator hasn't been defined already
808808
self._doc[self._X_APIGW_REQUEST_VALIDATORS].update(request_validator_definition)
809809

810-
# It is possible that the method could have two definitions in a Fn::If block.
811-
for method_definition in self.get_method_contents(self.get_path(path)[normalized_method_name]):
812-
813-
# If no integration given, then we don't need to process this definition (could be AWS::NoValue)
814-
if not self.method_definition_has_integration(method_definition):
815-
continue
810+
for method_name, method in self.get_path(path).items():
811+
# It is possible that the method could have two definitions in a Fn::If block.
812+
for method_definition in self.get_method_contents(method):
813+
# If no integration given, then we don't need to process this definition (could be AWS::NoValue)
814+
if not self.method_definition_has_integration(method_definition):
815+
continue
816816

817-
set_validator_to_method = {self._X_APIGW_REQUEST_VALIDATOR: validator_name}
818-
# Setting validator to the given method
819-
method_definition.update(set_validator_to_method)
817+
set_validator_to_method = {self._X_APIGW_REQUEST_VALIDATOR: validator_name}
818+
# Setting validator to the given method
819+
method_definition.update(set_validator_to_method)
820820

821821
def add_request_model_to_method(self, path, method_name, request_model):
822822
"""

0 commit comments

Comments
 (0)