protocol buffers - How to distinguish between a protobuf repeated field being explicitly set to empty list vs. not set at all (in python)? -


i've repeated field in protobuf that's exposed callers. i'd know if caller explicitly set empty list or if field not set @ all.

the hasfield method not work repeated fields, tried enumerating set fields using listfields method. unfortunately, irrespective of whether "message.repeated_field.extend([])" or don't set field @ all, field not show in listfields().

is possible distinguish between repeated fields being set empty vs not set all? if so, pointers helpful.

everything i've seen says not possible distinguish between empty repeated fields , unset repeated fields.

i solve this:

message namelist {    repeated string names = 1; }  message someresponse {    optional namelist names = 1; } 

then when want send empty list initialize namelist field.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -