From 3aab340b82fdaec4465e1cf1e632b2b52c6ddf4f Mon Sep 17 00:00:00 2001 From: Roman Tolkachyov Date: Wed, 25 Dec 2024 19:56:31 +0300 Subject: [PATCH 1/2] support allOf in parameters schema --- sphinxcontrib/openapi/openapi31.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinxcontrib/openapi/openapi31.py b/sphinxcontrib/openapi/openapi31.py index eb3a7e0..2ec18d9 100644 --- a/sphinxcontrib/openapi/openapi31.py +++ b/sphinxcontrib/openapi/openapi31.py @@ -302,7 +302,7 @@ def _get_type_from_schema(schema): dtype = schema["type"] else: dtype = set() - for t in schema["anyOf"]: + for t in schema.get("anyOf", schema.get("allOf")): if "format" in t.keys(): dtype.add(t["format"]) else: From 09e8bedd8fcef2f80826b55a0504bf25780052b0 Mon Sep 17 00:00:00 2001 From: Roman Tolkachyov Date: Thu, 9 Jan 2025 00:32:14 +0300 Subject: [PATCH 2/2] fix use empty list default to empty list Co-authored-by: Stephen Finucane --- sphinxcontrib/openapi/openapi31.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinxcontrib/openapi/openapi31.py b/sphinxcontrib/openapi/openapi31.py index 2ec18d9..da27d70 100644 --- a/sphinxcontrib/openapi/openapi31.py +++ b/sphinxcontrib/openapi/openapi31.py @@ -302,7 +302,7 @@ def _get_type_from_schema(schema): dtype = schema["type"] else: dtype = set() - for t in schema.get("anyOf", schema.get("allOf")): + for t in schema.get("anyOf", schema.get("allOf", [])): if "format" in t.keys(): dtype.add(t["format"]) else: