Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion flask_parameter_validation/parameter_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def nested_func(**kwargs):
# Step 3 - Extract list of parameters expected to be lists (otherwise all values are converted to lists)
expected_list_params = []
for name, param in expected_inputs.items():
if str(param.annotation).startswith("typing.List"):
if str(param.annotation).startswith("typing.List") or str(param.annotation).startswith("typing.Optional[typing.List"):
expected_list_params.append(name)

# Step 4 - Convert request inputs to dicts
Expand Down Expand Up @@ -168,6 +168,7 @@ def validate(self, expected_input, all_request_inputs):
if expected_input_type_str.startswith("typing.Optional"):
new_type = expected_input_type.__args__[0]
expected_input_type = new_type
expected_input_type_str = str(new_type)

# Prepare expected type checks for unions, lists and plain types
if expected_input_type_str.startswith("typing.Union"):
Expand Down