ruiaylin / goprotobuf

Automatically exported from code.google.com/p/goprotobuf
Other
0 stars 0 forks source link

Expose registered enums, or generate code for use with testing/quick #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently there is no way (of which I am aware) to be able to allow 
testing/quick to properly generate a valid instance from the generated protobuf 
struct.

The main problem is that the quick.Value() function is unaware of any 
constraints put on enum fields.  It would be very nice to either have the 
requisite Generate() function made during code generation, or at the very least 
to expose enum maps via a RegisteredEnums() function to allow application code 
to implement a Generate() that properly satisfies the enum constraints. 

Original issue reported on code.google.com by chr...@tune.com on 5 Nov 2014 at 6:43

GoogleCodeExporter commented 9 years ago
Enums don't, in practice, have constraints. They have an enumeration of named 
values, but they'll accept unknown values since they're really just an int32 
under the hood.

Original comment by dsymo...@golang.org on 5 Nov 2014 at 10:49

GoogleCodeExporter commented 9 years ago

Original comment by dsymo...@golang.org on 24 Nov 2014 at 12:14