Skip to content

Commit 192f0a0

Browse files
authored
Fix rec_strict_json_schema for None default fields models (#219)
1 parent be02ba7 commit 192f0a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mistralai/extra/utils/_pydantic_helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from typing import Any
22

3+
34
def rec_strict_json_schema(schema_node: Any) -> Any:
45
"""
56
Recursively set the additionalProperties property to False for all objects in the JSON Schema.
67
This makes the JSON Schema strict (i.e. no additional properties are allowed).
78
"""
8-
if isinstance(schema_node, (str, bool)):
9+
if isinstance(schema_node, (str, bool)) or schema_node is None:
910
return schema_node
1011
if isinstance(schema_node, dict):
1112
if "type" in schema_node and schema_node["type"] == "object":

0 commit comments

Comments
 (0)