Skip to content

Commit c2d7bc3

Browse files
committed
fix: comments
1 parent 0c2db13 commit c2d7bc3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

aws_lambda_powertools/event_handler/middlewares/openapi_validation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ def _validate_field(
311311
loc: Tuple[str, ...],
312312
existing_errors: List[Dict[str, Any]],
313313
):
314+
"""
315+
Validate a field, and append any errors to the existing_errors list.
316+
"""
314317
validated_value, errors = field.validate(value, value, loc=loc)
315318

316319
if isinstance(errors, list):
@@ -331,6 +334,7 @@ def _get_embed_body(
331334
field_info = field.field_info
332335
embed = getattr(field_info, "embed", None)
333336

337+
# If the field is an embed, and the field alias is omitted, we need to wrap the received body in the field alias.
334338
field_alias_omitted = len(required_params) == 1 and not embed
335339
if field_alias_omitted:
336340
received_body = {field.alias: received_body}

0 commit comments

Comments
 (0)