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

Ignore reserved fields for enums #1284

Open
mastersingh24 opened this issue Aug 25, 2019 · 0 comments
Open

Ignore reserved fields for enums #1284

mastersingh24 opened this issue Aug 25, 2019 · 0 comments

Comments

@mastersingh24
Copy link

protobuf.js version: 5.0.3

We have a proto message which uses the **reserved** keyword in an enum:
enum HeaderType {
    // Prevent removed tag re-use
    // Uncomment after fabric-baseimage moves to 3.5.1
    // reserved 7;
    // reserved "PEER_RESOURCE_UPDATE";
    reserved 7, 9;
    reserved "PEER_RESOURCE_UPDATE", "TOKEN_TRANSACTION";

    MESSAGE = 0;                     // Used for messages which are signed but opaque
    CONFIG = 1;                      // Used for messages which express the channel config
    CONFIG_UPDATE = 2;               // Used for transactions which update the channel config
    ENDORSER_TRANSACTION = 3;        // Used by the SDK to submit endorser based transactions
    ORDERER_TRANSACTION = 4;         // Used internally by the orderer for management
    DELIVER_SEEK_INFO = 5;           // Used as the type for Envelope messages submitted to instruct the Deliver API to seek
    CHAINCODE_PACKAGE = 6;           // Used for packaging chaincode artifacts for install
    PEER_ADMIN_OPERATION = 8;        // Used for invoking an administrative operation on a peer
}

While ProtoBuf5 does not actually support reserved fields, the parser ignores it for other token types.

ProtoBuf6 actually supports parsing reserved fields and fixed the issue for enum in #950 .

It's not easy for us to move to the latest release, so we'd like to push a fix for ProtoBuf5

<please provide a code snippet for reproduction>
<please paste the stack trace of the error if applicable>
mastersingh24 added a commit to mastersingh24/protobuf.js that referenced this issue Aug 25, 2019
ProtoBuf5 ignores reserved fields except
in the case of enums.

Fixes protobufjs#1284

Signed-off-by: Gari Singh <gari.r.singh@gmail.com>
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