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
11 changes: 8 additions & 3 deletions xsdata/codegen/handlers/update_attributes_effective_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,14 @@ def group_repeating_attrs(cls, target: Class) -> list[list[int]]:
# (e.g., one in outer sequence, one in inner choice branch)
result.append(list(range(indices[0], indices[-1] + 1)))
elif len(choice_ids) == 1 and len(path_lengths) == 1:
# All elements in the same choice at the same nesting level
# This is a repeating pattern, group them
result.append(list(range(indices[0], indices[-1] + 1)))
# Check if all occurrences have the same path
# If they have different paths within the same choice,
# they're in different branches (mutually exclusive)
paths = {tuple(target.attrs[i].restrictions.path) for i in indices}
if len(paths) == 1:
# All elements in the same choice at the same nesting level
# This is a repeating pattern, group them
result.append(list(range(indices[0], indices[-1] + 1)))
# else: different choices or same choice but different nesting levels
# = mutually exclusive branches, don't group

Expand Down
Loading