Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Cannot serialize object when key has underline #20

Closed
yyfrankyy opened this Issue · 6 comments

4 participants

@yyfrankyy

Key hello_world in js object need to be changed to helloWorld. weird..

But what if I have another key named helloWorld ?

message {
  required string hello_world = 1;
  required string helloWorld = 2;
}
@AdamMagaluk

Having the same issue on protobuf v0.8.6. Any key with an underscore does not get serialized.

@AdamMagaluk

Submitted pull request to fix this issue. #21

@AdamMagaluk

Currently the default functionality is to convert all assessors to camel case. "hello_world" would then be accessed by "helloWorld".

@seishun

Using underscore separated names for field names in the convention in protobuf. If your schema defines hello_world and helloWorld in the same message, then you should complain to the author of the schema, because it will break the official Java implementation as well.

@yyfrankyy

@seishun If it broke the official java implementation as well, then that's a problem. Language compatibility is one of the features that protobuf provides, as I known so far, cpp, ruby, python implementations are ok with this.

@chrisdew
Owner

I'm closing this, as there's been no activity, and @seishun is right.

@chrisdew chrisdew closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.