Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def _to_aifunction(self, foundry_tool: "ResolvedFoundryTool") -> AIFunction:
# Build field definitions for the Pydantic model
field_definitions: Dict[str, Any] = {}
for field_name, field_info in properties.items():
if field_info.type is None:
logger.warning("Skipping field '%s' in tool '%s': unknown or empty schema type.",
field_name, foundry_tool.name)
continue
field_type = field_info.type.py_type
field_description = field_info.description or ""
is_required = field_name in required_fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,20 @@ class SchemaProperty(BaseModel):
keyword; it is *not* “this property is required in a parent object”.)
"""

type: SchemaType
type: Optional[SchemaType] = None
"""The schema node type (e.g., ``string``, ``object``, ``array``). May be ``None``
if the upstream tool manifest supplies an empty or unrecognised type string."""
description: Optional[str] = None

@model_validator(mode="before")
@classmethod
def _coerce_empty_type(cls, data: Any) -> Any:
"""Coerce an empty ``type`` string to ``None`` so that properties with
invalid or missing type information are still deserialised instead of
raising a validation error."""
if isinstance(data, dict) and data.get("type") == "":
data = {**data, "type": None}
return data
items: Optional["SchemaProperty"] = None
properties: Optional[Mapping[str, "SchemaProperty"]] = None
default: Any = None
Expand Down