How to set values for a large number of fields in operational stats?

I have an oper model in Yang with a large number of leaf nodes. This is for showing the values of operational stats. The data comes from an external data provider and I have a get_next_object handler implementation. For each key, I have a ton of stats to show and I currently use CONFD_SET_TAG_UINT64() to set each one of them. Is there a better way? The problem with this approach is that the code gets bulky and it can get difficult when I add/remove stats in future as both the Yang model and the data provider logic have to change.

There are several other options than to manually write CONFD_SET_TAG_XXX() for every leaf. Based on what you write, it looks like you can use runtime schema information, see man confd_types - it describes how you can get node info for your list node and its children nodes. This assumes you have straightforward mapping between node names and the actual data sources. If that’s not the case, you might need to add something to your data model; the simplest way for you is probably to use tailf:meta-data which gets propagated to the schema information.