File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -237,26 +237,23 @@ async def check_call(args):
237
237
def test_complex_function_json_schema ():
238
238
"""Test JSON schema generation for complex function arguments.
239
239
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:
242
244
{
243
- "$ref": "#/$defs/Model",
245
+ "allOf": [{" $ref": "#/$defs/Model"}] ,
244
246
"default": {}
245
247
}
246
248
247
- 2. Pydantic 2.7.2+ :
249
+ 2. Since 2.9.0 :
248
250
{
249
- "allOf": [
250
- {
251
- "$ref": "#/$defs/Model"
252
- }
253
- ],
251
+ "$ref": "#/$defs/Model",
254
252
"default": {}
255
253
}
256
254
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.
260
257
261
258
This change in format does not affect runtime behavior since:
262
259
1. Both schemas validate the same way
You can’t perform that action at this time.
0 commit comments