I’d like to get configurable folder and device defaults working. Now the question is how to represent that in proto. In pure go my intention was to have a
DefaultFolderConfiguration type with a subset of the configurable options in
FolderConfiguration and embed that.
gogoproto.embed which allows me to do the same in proto. However that seems against the spirit of proto: If proto is used for anything non-go, there’s likely no equivalent to embedding and/or the proto generator wont support it. And having to access a config value through an intermediate object like
cfg.defaults.ignorePerms is not nice.
Alternatively we could define our own proto extension e.g. called
ext.nodefault and then store an entire
FolderConfiguration object as default. Then we translate that to an attribute and when using the defaults object, ignore any members with said attribute.
And finally we could just accept some duplication, having both
DefaultFolderConfiguration proto messages where the default one contains copies of the desired fields.
I am currently favoring the last option, just because it’s the simplest for actual usage. The manual work of copy&pasting fields is really small, and if it’s a concern I could create some config file that contains a list of fields to be excluded from defaults and autogenerate/check the defaults proto message at build time.
What are your thoughts on this?