status-im / nim-protobuf-serialization

Apache License 2.0
19 stars 4 forks source link

Support for different enums that have fields with the same name #19

Open michaelsbradleyjr opened 3 years ago

michaelsbradleyjr commented 3 years ago

The title of this issue is probably worded poorly. I am in the process of learning about protofbuffers and consumption of their specs with nim-protobuf-serialization.

I recently ran into a problem where status-go's chat_message.proto, which has an enum ContentType with a field SYSTEM_MESSAGE_GAP, imports enum.proto, which has an enum MessageType with a field SYSTEM_MESSAGE_GAP.

During Nim compilation involving import_proto3 of chat_message.proto, there was an error from nim-protobuf-serialization re: duplicate SYSTEM_MESSAGE_GAP.

I'm not sure if it's a bug/limitation in nim-protobuf-serialization or a problem with the specs.

As a workaround, I tried prefixing SYSTEM_MESSAGE_GAP, e.g. CHAT_MESSAGE_SYSTEM_MESSAGE_GAP and ENUMS_SYSTEM_MESSAGE_GAP, assuming the assigned number is more important than the name.

I'm already aware of some other workarounds necessary, cf. #15.

arnetheduck commented 1 year ago

as of #36, enum support has temporarily been removed - this should be revisited when reimplementing enums