valid? method should validate child messages when present
Closed this issue · 1 comments
rhettc commented
consider:
message Foo {
required int32 id = 1;
optional Bar bar =2;
}
message Bar {
required int32 = 1;
}
f = Foo.new
f.id = 300
f.valid? # true (as expected)
b = Bar.new
f.bar = b
f.valid? #true (but should be false since f cannot be encoded)
Perhaps an alternative would be to indicate which message type failed validation when encoding.
Cheers
codekitchen commented
Yeah, valid?
needs to modified to be recursive to sub-messages. Clearer encoding errors would be great too.