You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parsing enums with complex options should work. Currently it simply crashes when it gets into the RHS of the option, though not immediately. This is a sanitized version of a real proto used at my company, which seems to work fine with the Google protobuf tools but fails to parse with protobuf.js. I don't know protos that well so I am not exactly sure what the problem is.
This is part of a version 2 syntax file. The Protocol Buffer syntax definition for enums seems to indicate that the RHS of an option should be a constant. I don't know whether this qualifies, but like I said it works fine in our infrastructure.
enumAnEnum {
LEGACY=1 [
(some.custom.option) = {
type: {[an.api.type]: ITEM}, // crash on this linetype: {[an.api.type]: PAGE},
}
];
}
Error: illegal value '{' (line 4)
at illegal (node_modules/protobufjs/src/parse.js:98:16)
at readValue (node_modules/protobufjs/src/parse.js:137:19)
at parseOptionValue (node_modules/protobufjs/src/parse.js:562:59)
at parseOption (node_modules/protobufjs/src/parse.js:548:9)
at parseInlineOptions (node_modules/protobufjs/src/parse.js:578:17)
at parseEnumValue_line (node_modules/protobufjs/src/parse.js:525:13)
at ifBlock (node_modules/protobufjs/src/parse.js:294:17)
at parseEnumValue (node_modules/protobufjs/src/parse.js:515:9)
at parseEnum_block (node_modules/protobufjs/src/parse.js:501:17)
at ifBlock (node_modules/protobufjs/src/parse.js:290:17)
The text was updated successfully, but these errors were encountered:
The syntax definition for constant is defined earlier on that page, here. The value you have written there ({type: {[an.api.type]: ITEM}, type: {[an.api.type]: PAGE},}) does not appear to be a valid constant value as defined there.
protobuf.js version: 6.7.3
Parsing enums with complex options should work. Currently it simply crashes when it gets into the RHS of the option, though not immediately. This is a sanitized version of a real proto used at my company, which seems to work fine with the Google protobuf tools but fails to parse with protobuf.js. I don't know protos that well so I am not exactly sure what the problem is.
This is part of a version 2 syntax file. The Protocol Buffer syntax definition for enums seems to indicate that the RHS of an option should be a constant. I don't know whether this qualifies, but like I said it works fine in our infrastructure.
The text was updated successfully, but these errors were encountered: