Skip to content

Commit

Permalink
Make struct name fixup work correctly for nested structs. (#34619)
Browse files Browse the repository at this point in the history
The code that did struct name fixup did not handle nested structs
(e.g. struct-typed command fields, or struct-typed struct fields) correctly.  In
particular, it would not recursively call itself on the value for a field unless
it was fixing up the field name.  But there might be field names that don't need
fixup that have values that are structs whose fields do need name fixup.

The fix is to always call StructFieldsNameConverter on field values, and only
condition the deletion of the "old name" from the value dictionary on whether
the name is being fixed up.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Aug 29, 2024
1 parent 5d6d8c7 commit 4a93ea3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,16 @@ def run(self, specs, value, cluster_name: str, typename: str, array: bool):
provided_field_name = provided_field_name[0].lower(
) + provided_field_name[1:]

if provided_field_name in value and provided_field_name != field_name:
if provided_field_name in value:
value[field_name] = self.run(
specs,
value[provided_field_name],
cluster_name,
field_type,
field_array
)
del value[provided_field_name]
if provided_field_name != field_name:
del value[provided_field_name]

if specs.is_fabric_scoped(struct):
if _FABRIC_INDEX_FIELD_CODE in value:
Expand Down

0 comments on commit 4a93ea3

Please sign in to comment.