Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extension support problem #7

Closed
seabadger opened this issue Nov 21, 2017 · 1 comment
Closed

extension support problem #7

seabadger opened this issue Nov 21, 2017 · 1 comment

Comments

@seabadger
Copy link

I'm having trouble getting nested extensions to serialize correctly.

Given these definitions:

message Person {
   required int32 id = 1;
   required string name = 2;
   optional string email = 3;
   repeated int32 arr = 4;
   extensions 10 to max;
}

extend Person {
   optional int32 test  = 11;
}

I'm able to serialize an instance of Person with the 'test' field with no problems:

local p = {
   id = 3, name = "Alice",
   test = 15
}
pb.encode("Person", p)
-- and then decode, compare the results -- and all is well

HOWEVER: if the extension is instead written as below (replacing the above):

message ExtendedPerson {
  extend Person {
    optional int32 test  = 11;
  } 
}

I'm unable to serialize the message successfully (after deserialization, it comes out as nil):

-- p is same as above
pb.encode("ExtendedPerson", p)

Do I need to set up the table differently for this case? Or is this not supported?

@seabadger
Copy link
Author

closing; apparnetly, this issue was indirectly being caused by the 'oneof' issue I filed previously; when loading a protobuf definitions file containing a type with 'oneof', any types that occur afterwards in that file are not found by the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant