Skip to content

Commit 2fd4b3b

Browse files
committed
test: cover malformed defs guard
1 parent 167903b commit 2fd4b3b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/server/mcpserver/utilities/test_schema.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ def test_null_defs_returns_schema_unchanged(self) -> None:
153153
result = dereference_local_refs(schema)
154154
assert result is schema
155155

156+
def test_non_object_defs_returns_schema_unchanged(self) -> None:
157+
"""Malformed non-object defs are ignored without copying the schema."""
158+
schema: dict[str, Any] = {"type": "object", "$defs": ["not", "an", "object"]}
159+
result = dereference_local_refs(schema)
160+
assert result is schema
161+
156162
def test_inlines_through_array_of_objects(self) -> None:
157163
"""Refs nested inside arrays of dict items are recursed properly.
158164

0 commit comments

Comments
 (0)