valid? method should validate child messages when present #14

Closed
rhettc opened this Issue Oct 27, 2011 · 1 comment

Projects

None yet

2 participants

@rhettc
rhettc commented Oct 27, 2011

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
Collaborator

Yeah, valid? needs to modified to be recursive to sub-messages. Clearer encoding errors would be great too.

@codekitchen codekitchen added a commit that closed this issue Apr 25, 2012
@codekitchen codekitchen validate sub-messages
fixes #14
da767f8
@kb kb added a commit to crashlytics/ruby-protocol-buffers that referenced this issue Jun 25, 2013
@codekitchen codekitchen validate sub-messages
fixes #14
2043c30
@jwroblewski jwroblewski pushed a commit to liquidm/ruby-protocol-buffers that referenced this issue Jan 11, 2014
@codekitchen codekitchen add license summary to gemfile
closes #14
b889d9d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment