From faeb7eee6ac177a07202c52e7057a801fcf96134 Mon Sep 17 00:00:00 2001 From: Harshit Sharma <66710144+harshitethic@users.noreply.github.com> Date: Wed, 2 Sep 2026 03:47:38 +0530 Subject: [PATCH] test(strict-schema): cover default removal in referenced schemas --- tests/test_strict_schema_default_refs.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/test_strict_schema_default_refs.py diff --git a/tests/test_strict_schema_default_refs.py b/tests/test_strict_schema_default_refs.py new file mode 100644 index 0000000000..089899b5f4 --- /dev/null +++ b/tests/test_strict_schema_default_refs.py @@ -0,0 +1,23 @@ +import copy + +from agents.strict_schema import ensure_strict_json_schema + + +def test_default_none_is_removed_from_referenced_property(): + schema = { + "$defs": { + "Value": { + "type": "string", + "default": None, + } + }, + "type": "object", + "properties": { + "value": {"$ref": "#/$defs/Value"}, + }, + } + + result = ensure_strict_json_schema(copy.deepcopy(schema)) + + assert result["$defs"]["Value"] == {"type": "string"} + assert result["properties"]["value"] == {"$ref": "#/$defs/Value"}