Open magodo opened 4 years ago
The impact field is within the expand/flatten function related stuff, which currently covers EnumArrayObject
, ComplexObject
and ComplexArrayObject
sdk types (maybe more...).
A quick fix would be to change @func_name
definition, where we should also check whether the accepted sdk field is an array or not. If it's an array, prefix/suffix go_type_name
with "array"-like word to be as the @func_name
.
A more general fix would be to elliminate the ambiguity of go_type_name
, and then change the the @func_name
duduction logic. This might introduce new field into SDKTypeDefinition.
When a
ExpandFlattenDescriptor
is constructed forComplexObject
orComplexArrayObject
sdk fields, the@func_name
is deduced from thego_type_name
of those fields.Since
go_type_name
has ambiguous meanings when applied toComplexObject
(which indicates the type of this complex object, i.e. struct type) andComplexArrayObject
(which indicates the type of element type). In some case, thesego_type_name
(s) might be same. However since their properties are different, magic module will generate expand/flatten function for both of them, with same name. This will introduce redeclaration error in generated code.