From 917cf9ac0b949d344fcbb8154581eb1684c8e219 Mon Sep 17 00:00:00 2001 From: Nathaniel King <65478000+nathanielarking@users.noreply.github.com> Date: Thu, 18 Jan 2024 07:12:11 +0000 Subject: [PATCH 1/4] fix: update http exception's schema construction to include items keyword --- litestar/_openapi/responses.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litestar/_openapi/responses.py b/litestar/_openapi/responses.py index 4d9e42b7af..7f69121585 100644 --- a/litestar/_openapi/responses.py +++ b/litestar/_openapi/responses.py @@ -280,7 +280,7 @@ def create_error_responses(exceptions: list[type[HTTPException]]) -> Iterator[tu "status_code": Schema(type=OpenAPIType.INTEGER), "detail": Schema(type=OpenAPIType.STRING), "extra": Schema( - type=[OpenAPIType.NULL, OpenAPIType.OBJECT, OpenAPIType.ARRAY], + any_of=[Schema(type=OpenAPIType.NULL), Schema(type=OpenAPIType.OBJECT), Schema(type=OpenAPIType.ARRAY, items=Schema())], additional_properties=Schema(), ), }, From 482ddca5a5697401a67345a2a97529dd9857dbf8 Mon Sep 17 00:00:00 2001 From: Nathaniel King <65478000+nathanielarking@users.noreply.github.com> Date: Fri, 19 Jan 2024 04:20:57 +0000 Subject: [PATCH 2/4] fix: reformat --- litestar/_openapi/responses.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/litestar/_openapi/responses.py b/litestar/_openapi/responses.py index 7f69121585..d7a4108fae 100644 --- a/litestar/_openapi/responses.py +++ b/litestar/_openapi/responses.py @@ -280,7 +280,11 @@ def create_error_responses(exceptions: list[type[HTTPException]]) -> Iterator[tu "status_code": Schema(type=OpenAPIType.INTEGER), "detail": Schema(type=OpenAPIType.STRING), "extra": Schema( - any_of=[Schema(type=OpenAPIType.NULL), Schema(type=OpenAPIType.OBJECT), Schema(type=OpenAPIType.ARRAY, items=Schema())], + any_of=[ + Schema(type=OpenAPIType.NULL), + Schema(type=OpenAPIType.OBJECT), + Schema(type=OpenAPIType.ARRAY, items=Schema()) + ], additional_properties=Schema(), ), }, From b2951ef2c8d53689279b04a30d9f40b32bf96b50 Mon Sep 17 00:00:00 2001 From: Nathaniel King <65478000+nathanielarking@users.noreply.github.com> Date: Fri, 19 Jan 2024 04:28:01 +0000 Subject: [PATCH 3/4] fix: reformat --- litestar/_openapi/responses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litestar/_openapi/responses.py b/litestar/_openapi/responses.py index d7a4108fae..c3b2111388 100644 --- a/litestar/_openapi/responses.py +++ b/litestar/_openapi/responses.py @@ -281,8 +281,8 @@ def create_error_responses(exceptions: list[type[HTTPException]]) -> Iterator[tu "detail": Schema(type=OpenAPIType.STRING), "extra": Schema( any_of=[ - Schema(type=OpenAPIType.NULL), - Schema(type=OpenAPIType.OBJECT), + Schema(type=OpenAPIType.NULL), + Schema(type=OpenAPIType.OBJECT), Schema(type=OpenAPIType.ARRAY, items=Schema()) ], additional_properties=Schema(), From bf0411970133464be29761adf49be2dc2016b7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janek=20Nouvertn=C3=A9?= <25355197+provinzkraut@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:51:51 +0100 Subject: [PATCH 4/4] Formatting --- litestar/_openapi/responses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litestar/_openapi/responses.py b/litestar/_openapi/responses.py index c3b2111388..92c146f422 100644 --- a/litestar/_openapi/responses.py +++ b/litestar/_openapi/responses.py @@ -283,8 +283,8 @@ def create_error_responses(exceptions: list[type[HTTPException]]) -> Iterator[tu any_of=[ Schema(type=OpenAPIType.NULL), Schema(type=OpenAPIType.OBJECT), - Schema(type=OpenAPIType.ARRAY, items=Schema()) - ], + Schema(type=OpenAPIType.ARRAY, items=Schema()), + ], additional_properties=Schema(), ), },