PMunch / protobuf-nim

Protobuf implementation in pure Nim that leverages the power of the macro system to not depend on any external tools
MIT License
171 stars 14 forks source link

parse error #31

Closed geohuz closed 1 year ago

geohuz commented 1 year ago

proto file: connection.proto

syntax = "proto3";

enum CONNECTION_ACTION {
    CONNECTION_UNKNOWN = 0;

    CONNECTION_ERROR = 1;
    CONNECTION_PING = 2;
    CONNECTION_PONG = 3;
    CONNECTION_ACCEPT = 4;
    CONNECTION_CHALLENGE = 5;
    CONNECTION_REJECT = 6;
    CONNECTION_REDIRECT = 7;
    CONNECTION_CLOSING = 8;
    CONNECTION_CLOSED = 9;

    CONNECTION_AUTHENTICATION_TIMEOUT = 100;
    CONNECTION_INVALID_MESSAGE = 101;
}

message ConnectionMessage {
    CONNECTION_ACTION action = 1;
    string data = 2;
    bool isError = 3;
    bool isAck = 4;

    string url = 5;
    string protocolVersion = 6;
    string sdkType = 8;
    string sdkVersion = 7;
  }

code:

import protobuf

parseProtoFile("connection.proto")

Error Message:

Error: unhandled exception: Type not recognized: ConnectionMessage.CONNECTION_ACTION [ValidationError]
geohuz commented 1 year ago

I missed "package" specification.