zap icon indicating copy to clipboard operation
zap copied to clipboard

struct_contains_array must calculate transitive dependencies

Open gmarcosb opened this issue 1 year ago • 0 comments

ZAP templates currently decide how to generate Type vs DecodableType based on struct_contains_array

However, this only works if the array is a field in the struct; if the array is contained > 1 level (a struct referencing a struct with an array field), the resulting cluster-objects generated file is invalid

Fix @ https://github.com/project-chip/zap/pull/1501

Effectively, DecodableType is aliased to Type if a struct does not have an array field

Problem is: TransportOptionsStruct referenced from the command does not have an array, so Type ends up being aliased to DecodableType - but it contains a field to a struct (TransportTriggerOptionsStruct) which does have an array, an then we get a compiler failure

When deciding whether TransportOptionsStruct should have its DecodableType aliased to Type, we also need to check if its children (such as TransportTriggerOptionsStruct) are also eligible, otherwise it cannot alias

gmarcosb avatar Dec 23 '24 20:12 gmarcosb