mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-23 22:14:18 +02:00
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>
This commit is contained in:
parent
a3927d556d
commit
08236c4345
1 changed files with 3 additions and 3 deletions
|
|
@ -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", "<unknown>"), 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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue