Skip to content

Commit 28352b7

Browse files
authored
fix: update error message to contain the normalized method rather than the method dict (#2414)
1 parent 67c2358 commit 28352b7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

samtranslator/open_api/open_api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,11 @@ def set_path_default_authorizer(self, path, default_authorizer, authorizers, api
400400
# check if there is any method_definition given by customer
401401
if not method_definition:
402402
raise InvalidDocumentException(
403-
[InvalidTemplateException(f"Invalid method definition ({method}) for path: {path}")]
403+
[
404+
InvalidTemplateException(
405+
f"Invalid method definition ({normalized_method_name}) for path: {path}"
406+
)
407+
]
404408
)
405409
# If no integration given, then we don't need to process this definition (could be AWS::NoValue)
406410
if not self.method_definition_has_integration(method_definition):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Structure of the SAM template is invalid. Invalid method definition (None) for path: /test"
2+
"errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Structure of the SAM template is invalid. Invalid method definition (post) for path: /test"
33
}

0 commit comments

Comments
 (0)