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

Support for reserved keywords #344

Closed
mwildehahn opened this issue Oct 28, 2015 · 5 comments
Closed

Support for reserved keywords #344

mwildehahn opened this issue Oct 28, 2015 · 5 comments

Comments

@mwildehahn
Copy link

https://developers.google.com/protocol-buffers/docs/proto3#reserved

i get the following error when trying to do something like the following:

message Test {
     reserved 1;
     string other_field = 2;
}

->

/User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/dist/ProtoBuf.js:782
                throw e;
                ^

Error: Parse error at line 5: illegal message field name: 1
    at Error (native)
    at ProtoBuf.DotProto.ParserPrototype._parseMessageField (/User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/dist/ProtoBuf.js:1184:68)
    at ProtoBuf.DotProto.ParserPrototype._parseMessage (/User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/dist/ProtoBuf.js:1107:26)
    at ProtoBuf.DotProto.ParserPrototype.parse (/User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/dist/ProtoBuf.js:760:34)
    at Function.ProtoBuf.DotProto.Parser.parse (/User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/dist/ProtoBuf.js:795:39)
    at Function.proto.load (/User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/cli/pbjs/sources/proto.js:61:41)
    at /User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/cli/pbjs/sources/proto.js:76:40
    at Function.proto.load (/User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/cli/pbjs/sources/proto.js:80:15)
    at /User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/cli/pbjs/sources/proto.js:76:40
    at Function.proto.load (/User/.nvm/versions/io.js/v3.3.1/lib/node_modules/protobufjs/cli/pbjs/sources/proto.js:80:15)
@dcodeIO
Copy link
Member

dcodeIO commented Oct 28, 2015

Currently, the reserved keyword isn't supported. Marked it as an enhancement for future support.

@dcodeIO
Copy link
Member

dcodeIO commented Nov 28, 2016

Closing this for now.

protobuf.js 6.0.0

Feel free to send a pull request if this is still a requirement.

@dcodeIO dcodeIO closed this as completed Nov 28, 2016
@schwiet
Copy link

schwiet commented Feb 7, 2017

So what is the suggestion for proto files using reserved? I just updated to 6.0.0 and files that were previously compiling with pbjs are not and the error is related to reserved fields.

Error: illegal token ',', ';' expected (line 105)

line 105 in the proto file
reserved 16, 21, 22;

@dcodeIO
Copy link
Member

dcodeIO commented Feb 8, 2017

Maybe try with latest instead, which is 6.6.3.

@schwiet
Copy link

schwiet commented Feb 8, 2017

Sorry for my confusing comment; I just meant to say that I updated from v5 to v6. I am using 6.6.3. Is reserved supposed to be supported now? I am having trouble compiling files with reserved and with allow_alias in enums. These files did previously compile fine.

I created this pull request to address the reserved issue: #676

and this one to address the allow_alias issue: #679

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

No branches or pull requests

3 participants