From 836d0b2f80ef1610288323c834b82e42d306a852 Mon Sep 17 00:00:00 2001 From: Matt Jones <47545907+SoundMatt@users.noreply.github.com> Date: Fri, 22 May 2026 10:29:03 -0700 Subject: [PATCH] fix(ifex_to_json_schema): use None sentinels for mutable default args `collect_type_info(t, collection={}, seen={})` creates both dicts once at function-definition time and reuses them across all calls. After the first run, `seen` already contains all visited types so subsequent calls find no new types, and `collection` accumulates data across unrelated invocations. Replace with `None` sentinels initialised inside the function body. Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com> --- ifex/output_filters/schema/ifex_to_json_schema.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ifex/output_filters/schema/ifex_to_json_schema.py b/ifex/output_filters/schema/ifex_to_json_schema.py index bb4f796..a9ef09e 100644 --- a/ifex/output_filters/schema/ifex_to_json_schema.py +++ b/ifex/output_filters/schema/ifex_to_json_schema.py @@ -113,9 +113,13 @@ def print_type(t, fields): # Model traversal # ======================================================================= -def collect_type_info(t, collection={}, seen={}): +def collect_type_info(t, collection=None, seen=None): """This is the main recursive function that loops through tree and collects information about its structure which is later used to output the schema:""" + if collection is None: + collection = {} + if seen is None: + seen = {} # We don't need to gather information about primitive types because they # will not have any member fields below them.