chrisdew / protobuf

Protocol Buffers for Node.JS
http://code.google.com/p/protobuf-for-node/
Apache License 2.0
234 stars 70 forks source link

Extensions #27

Open Jud opened 11 years ago

Jud commented 11 years ago

Extensions don't seem to work. For example, here is my base.proto:

message Request {
  enum RequestType {
    // Let us know you are a player
    AUTH  = 1;

    // These apply to `channels`
    JOIN  = 2;
    LEAVE = 3;

    // This is a passthrough type
    // Pocket will pass this to the server listeners
    // for decoding
    MESSAGE = 4;
  }

  message Auth {
    optional string key = 1;
    optional string verifier = 2;
  }

  message Channel {
    optional string name = 1;
  }

  required RequestType request_type = 1;

  optional Channel channel = 2;
  optional Auth auth = 4;

  extensions 100 to 199;
}

When I try to extend in extension.proto:

import "base.proto";

extend Request {
  required string name = 100;
}

Loading extension.proto and encoding anything always results in blank messages being encoded, causing the decode to fail since required fields are missing.