From 08236c4345ce58a3c9b50f0e080c45a6e719cb38 Mon Sep 17 00:00:00 2001 From: strawgate Date: Tue, 12 May 2026 22:48:36 -0500 Subject: [PATCH] fix: address review feedback on allOf/oneOf handling - Guard property+oneOf schemas from premature dataclass return - Recognize empty additionalProperties ({}) as allow-any in oneOf - Boolean false allOf branches and sibling properties already handled Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- fastmcp_slim/fastmcp/utilities/json_schema_type.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastmcp_slim/fastmcp/utilities/json_schema_type.py b/fastmcp_slim/fastmcp/utilities/json_schema_type.py index 3bd70c04a..b3163872b 100644 --- a/fastmcp_slim/fastmcp/utilities/json_schema_type.py +++ b/fastmcp_slim/fastmcp/utilities/json_schema_type.py @@ -453,7 +453,7 @@ def _schema_to_type( if not schema: return object - if "type" not in schema and "properties" in schema and "allOf" not in schema: + if "type" not in schema and "properties" in schema and "allOf" not in schema and "oneOf" not in schema: return _create_dataclass(schema, schema.get("title", ""), schemas) # Handle references first @@ -569,10 +569,10 @@ def _schema_to_type( isinstance(subschema, dict) and subschema.get("type") == "object" and not subschema.get("properties") - and subschema.get("additionalProperties") + and "additionalProperties" in subschema ): additional_props = subschema["additionalProperties"] - if additional_props is True: + if additional_props is True or additional_props == {}: types.append(dict[str, Any]) else: value_type = _schema_to_type(additional_props, schemas)