Start with adding tag_property, inner_property etc in to a TsEnumConfig struct. You will likely want to use a TemplateExpression for at least tag_class. You should put default values on this. You may want to add some methods on this, especially tag_class(&self, type_name: &str) -> String.
Add this to TsConfig in uniffi_toml.rs, as enums.
From the templates, you can access this method with config.enums.tag_class(type_name). Templates that mention _Tags, inner or tag are TaggedEnumTemplate.ts and `ObjectTemplate.ts.
Currently we have made a relatively arbitrary choice as to how to name of the generated structures.
This is most striking in the construction of tagged unions, i.e. enums with values:
The shape of instances of
MyEnum
is:Each of these
tag
,inner
andMyEnum_Tags
might be configurable viauniffi.toml
; perhaps a client may want to rename:Implementation sketch
tag_property
,inner_property
etc in to aTsEnumConfig
struct. You will likely want to use aTemplateExpression
for at leasttag_class
. You should put default values on this. You may want to add some methods on this, especiallytag_class(&self, type_name: &str) -> String
.TsConfig
inuniffi_toml.rs
, asenums
.config.enums.tag_class(type_name)
. Templates that mention_Tags
,inner
ortag
areTaggedEnumTemplate.ts
and `ObjectTemplate.ts.