OK, so the scenarios is that we have versioned data (schemas for the various versions auto generated) where we would want to use enums and would read the data using a manually assembled reader schema. We would use the reader schema to convert enums to string instead of the writer schema to avoid leaking specifics of a given version. Now if the specific writer schema has additional items for an enum compared to what we have in our reader schema we will eventually try to look up such unknown indices.
Theoretically we could work around this in other ways, but Avro-C is also lacking in that regard, I am OK, if we choose to fix that. For example I haven't found any specific schema function or straightforward approach which could tell me how many items an enum has. Otherwise I could do the bound checking myself before the lookup.
This also applies to the writer side, avro_value_set_enum() does not do any bound checking based on the schema, which is understandable due to performance, but there's no way for manual bound checking prior the writing either.
So, as an alternative proposal what do you think of adding avro_schema_enum_get_item_count(const avro_schema_t), which returns the num_entries of the symbols st_table? Then all the enum bound checkings can be left to the users if they opt to want that.
If you are OK with this I can attach a new patch with that one.