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

error on map field in proto with missing package name #10

Closed
devnev opened this issue Jun 4, 2017 · 1 comment
Closed

error on map field in proto with missing package name #10

devnev opened this issue Jun 4, 2017 · 1 comment

Comments

@devnev
Copy link

devnev commented Jun 4, 2017

Uncommenting any of the maps in the following file causes an error in the ts plugin:

$ cat bad.proto
syntax = "proto3";

message One {
  //map<string, string> foo = 1;
  //map<int32, int32> bar = 2;
  //map<string, Two> baz = 3;
}

message Two {
}

Command and error output when the foo field is uncommented:

$ protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=. bad.proto
protoc-gen-ts error: Error: No message export for: One.FooEntry
    at node_modules/ts-protoc-gen/lib/ts/message.js:57:23
    at Array.forEach (native)
    at Object.printMessage (node_modules/ts-protoc-gen/lib/ts/message.js:38:38)
    at node_modules/ts-protoc-gen/lib/ts/fileDescriptorTSD.js:29:33
    at Array.forEach (native)
    at Object.printFileDescriptorTSD (node_modules/ts-protoc-gen/lib/ts/fileDescriptorTSD.js:28:41)
    at node_modules/ts-protoc-gen/lib/ts_index.js:25:53
    at Array.forEach (native)
    at node_modules/ts-protoc-gen/lib/ts_index.js:21:48
    at Socket.<anonymous> (node_modules/ts-protoc-gen/lib/util.js:61:9)

Error is equivalent for any of the other fields.

Adding a package statement to the proto definition fixes the error:

$ cat good.proto 
syntax = "proto3";

package foo;

message One {
  map<string, string> foo = 1;
  map<int32, int32> bar = 2;
  map<string, Two> baz = 3;
}

message Two {
}

Running it succeeds:

$ protoc --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts --ts_out=. good.proto && echo success
success
@MarcusLongmuir
Copy link
Contributor

@devnev: Released in 0.3.2

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

2 participants