Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/openai/lib/_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _ensure_strict_json_schema(
_ensure_strict_json_schema(definition_schema, path=(*path, "definitions", definition_name), root=root)

typ = json_schema.get("type")
if typ == "object" and "additionalProperties" not in json_schema:
if typ == "object":
json_schema["additionalProperties"] = False
Comment on lines 49 to 51

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Force-disables schemas that intentionally allow dynamic properties

The new logic sets additionalProperties=False for every object schema, even when additionalProperties already contains a schema for dynamic keys (e.g. a field typed as dict[str, int] produces {"additionalProperties": {"type": "integer"}}). By overwriting that value with False we now forbid those dictionaries entirely and drop the nested schema information. The prior guard avoided this by only setting the flag when the key was absent, so this change regresses existing models that legitimately depend on additionalProperties being a schema rather than a boolean. Consider only forcing False when the value is missing or explicitly True for extra="allow" models, and preserve non‑boolean schemas.

Useful? React with 👍 / 👎.


# object types
Expand Down