From c371b65c30aea9c0169e9f3b6d1f98b472cd6e42 Mon Sep 17 00:00:00 2001 From: Micah Mangione Date: Mon, 22 Apr 2024 14:03:40 -0700 Subject: [PATCH] Update v3.py - Fix error in _get_array_outer_type The except clause of _get_array_outer_type can return field_info.annotation as a list, so the __args__ element is not valid. Check for this type and return the raw element. --- blacksheep/server/openapi/v3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blacksheep/server/openapi/v3.py b/blacksheep/server/openapi/v3.py index 920d041..3a62812 100644 --- a/blacksheep/server/openapi/v3.py +++ b/blacksheep/server/openapi/v3.py @@ -308,7 +308,7 @@ def _get_array_outer_type(self, field_info): except AttributeError: # Pydantic v2 # Here we support only simple types - return List[field_info.annotation.__args__[0]] + return field_info.annotation if type(field_info.annotation) is list else List[field_info.annotation.__args__[0]] def _get_fields_info(self, object_type): try: