fix(binapigen): Fix name conflict for union field constructors 02/28602/1
authorOndrej Fabry <ofabry@cisco.com>
Fri, 28 Aug 2020 18:42:20 +0000 (20:42 +0200)
committerOndrej Fabry <ofabry@cisco.com>
Fri, 28 Aug 2020 18:42:20 +0000 (20:42 +0200)
commit15c53e7a9da6f61448b77339b5b762ada0050aff
treed27febeb074d855ace564d09ad609f2556d5e63d
parenta4e8bf2efe9189ce795f87ab07adbb3780d01d7d
fix(binapigen): Fix name conflict for union field constructors

PROBLEM

Issue discovered in flow_types.api on master (20.09-rc0), where
generator encountered inconsistent naming for union type Flow,
causing name conflicts with their constructors.

SOLUTION

Previous cases of union types (address, punt) both contain suffix
"Union", thus generator now adds "Union" suffix it is not defined.
This way we won't break previously generated code for users.

Change-Id: Iffadc167774d66d8416fe36485782bb68ca2a70d
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
binapigen/binapigen.go
binapigen/generate.go