Skip to content

Commit 3f8c1ba

Browse files
leandrodamascenatonnico
authored andcommitted
Improving field validation method + tests
1 parent 3aaf6df commit 3f8c1ba

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

aws_lambda_powertools/event_handler/api_gateway.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,10 +895,8 @@ def _get_basic_type_schema(param_type: type) -> dict[str, str]:
895895
return {"type": "number"}
896896
elif isinstance(bool, param_type):
897897
return {"type": "boolean"}
898-
elif isinstance(str, param_type):
899-
return {"type": "string"}
900898
else:
901-
return {"type": "string"} # Default fallback
899+
return {"type": "string"}
902900

903901
@staticmethod
904902
def _openapi_operation_return(

aws_lambda_powertools/event_handler/middlewares/openapi_validation.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,6 @@ def _request_params_to_args_with_pydantic_support(
343343
values[field.name] = deepcopy(field.default)
344344
continue
345345

346-
# Use _validate_field like _request_body_to_args does
347-
values[field.name] = _validate_field(field=field, value=value, loc=loc, existing_errors=errors)
348346
else:
349347
# Regular parameter processing (existing logic)
350348
if not isinstance(field_info, Param):
@@ -360,8 +358,8 @@ def _request_params_to_args_with_pydantic_support(
360358
values[field.name] = deepcopy(field.default)
361359
continue
362360

363-
values[field.name] = _validate_field(field=field, value=value, loc=loc, existing_errors=errors)
364-
361+
# Use _validate_field like _request_body_to_args does
362+
values[field.name] = _validate_field(field=field, value=value, loc=loc, existing_errors=errors)
365363
return values, errors
366364

367365

0 commit comments

Comments
 (0)