Skip to content

Commit defd52b

Browse files
Fix comment about pydantic versioning
1 parent 0d48a44 commit defd52b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tests/server/fastmcp/test_func_metadata.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -237,26 +237,23 @@ async def check_call(args):
237237
def test_complex_function_json_schema():
238238
"""Test JSON schema generation for complex function arguments.
239239
240-
Note: This test accepts two equivalent JSON Schema formats for models with defaults:
241-
1. Pre-pydantic 2.7.2:
240+
Note: Different versions of pydantic output slightly different
241+
JSON Schema formats for model fields with defaults. The format changed in 2.9.0:
242+
243+
1. Before 2.9.0:
242244
{
243-
"$ref": "#/$defs/Model",
245+
"allOf": [{"$ref": "#/$defs/Model"}],
244246
"default": {}
245247
}
246248
247-
2. Pydantic 2.7.2+:
249+
2. Since 2.9.0:
248250
{
249-
"allOf": [
250-
{
251-
"$ref": "#/$defs/Model"
252-
}
253-
],
251+
"$ref": "#/$defs/Model",
254252
"default": {}
255253
}
256254
257-
Both formats are valid JSON Schema and represent the same validation rules.
258-
The newer format using allOf is more correct according to the JSON Schema spec
259-
as it properly composes the reference with additional properties.
255+
Both formats are valid and functionally equivalent. This test accepts either format
256+
to ensure compatibility across our supported pydantic versions.
260257
261258
This change in format does not affect runtime behavior since:
262259
1. Both schemas validate the same way

0 commit comments

Comments
 (0)