VSChina / magic-modules

Magic Modules: Automagically generate Google Cloud Platform support for OSS
Apache License 2.0
1 stars 4 forks source link

Add prop option to compact e/f func name #70

Closed magodo closed 5 years ago

magodo commented 5 years ago

Introduce a new property option: compact_ef_func_name to compact expand/flatten function name.

E/F func name is constrcuted as: resource_name + go_sdk_type_name. In some cases the go_sdk_type_name might use resource_name as prefix, which in most case is redundent (cause without which, there is no name conflict inside that go package). So as to make tf reviewer happy, we can turn that option on.

This fixes issue: #60

magodo commented 5 years ago

It seems this PR only changes the ef funtion name for function definition. I could't find the codes changes about property field assigning. Can you help validate it?

This is my fault, i should have tested it (at least compile the generated code).

Even if users set the auto-compact function name, we can not deal with all kinds of situations that may appear (e.g. expandArmWebApplicationFirewallPolicyWebApplicationFirewallCustomRule). How about we just leave this filed for users to flexibly customize the function name? (something like custom_ef_func_name) WDYT?

Yes, i agree. I assume that would be a mapping from the go_sdk_type_name to the final e/f func name, the resource_name can be omitted since the setting is already resided in a specific resource's definition/override.