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

[protobuf] can't parse reserved field #84

Open
knoguchi opened this issue Apr 29, 2017 · 3 comments
Open

[protobuf] can't parse reserved field #84

knoguchi opened this issue Apr 29, 2017 · 3 comments
Labels

Comments

@knoguchi
Copy link
Contributor

knoguchi commented Apr 29, 2017

This is a Protoparser problem that it failed to parse reserved field.

Reserved field is explained in the official document.
https://developers.google.com/protocol-buffers/docs/proto#reserved

va.lang.IllegalStateException: Syntax error in Unnamed-protobuf-schema at 389:11: unexpected label: reserved

	at com.squareup.protoparser.ProtoParser.unexpected(ProtoParser.java:948)
	at com.squareup.protoparser.ProtoParser.readDeclaration(ProtoParser.java:197)
	at com.squareup.protoparser.ProtoParser.readMessage(ProtoParser.java:219)
	at com.squareup.protoparser.ProtoParser.readDeclaration(ProtoParser.java:153)
	at com.squareup.protoparser.ProtoParser.readProtoFile(ProtoParser.java:92)
	at com.squareup.protoparser.ProtoParser.parse(ProtoParser.java:61)
	at com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchemaLoader._loadNative(ProtobufSchemaLoader.java:167)
	at com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchemaLoader._loadNative(ProtobufSchemaLoader.java:161)
	at com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchemaLoader.loadNative(ProtobufSchemaLoader.java:135)
	at com.fasterxml.jackson.dataformat.protobuf.schema.ProtobufSchemaLoader.load(ProtobufSchemaLoader.java:80)
@cowtowncoder
Copy link
Member

Do you know if this is a new addition to particular version of protobuf specification?

@knoguchi
Copy link
Contributor Author

I did a bit of research. It seems reserved was added when protobuf v3.0.0-beta was released 2 years ago for both proto2 and proto3 syntax.

The protoc-2.6.1 can't parse the syntax. So it's only available in the protobuf v3.x.x releases. It's a bit confusing but the release version and syntax version is not necessarily corresponding . The proto2 syntax is maintained in the v3 releases.


For now I just commented out the reserved fields. So this is not a big issue.

@cowtowncoder
Copy link
Member

Ok thank you for checking this out. I was just trying to figure this out since I did not remember seeing this keyword before myself.
It seems like a useful thing to have, of course, even with proto v2 as it does not change encoding format. And it is useful for general schema management.

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

No branches or pull requests

2 participants