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

pbjs: error when Enum contains negative number #609

Closed
halex2005 opened this Issue Jan 3, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@halex2005
Contributor

halex2005 commented Jan 3, 2017

protobuf.js version: 6.4.0 (current master, 751a90f)

I have two files:

  1. ResolutionRequestInfo.proto
package SomeNamespace;

message ResolutionRequestInfo {
	optional ResolutionRequestType RequestType = 1 [default = UnknownResolutionRequestType];
}

enum ResolutionRequestType {
	UnknownResolutionRequestType = -1;
	Value1 = 1;
	Value2 = 2;
	Value3 = 3;
}
  1. and ResolutionRequestAttachment.proto
import "ResolutionRequestInfo.proto";

package SomeNamespace;

message ResolutionRequestAttachment {
    required ResolutionRequestType Type = 1;
}

when I call

./bin/pbjs -o ResolutionRequestAttachment.js -t static ResolutionRequestAttachment.proto

I got error:

/home/hal/git/protobuf.js/cli/pbjs.js:165
            throw err;
            ^

Error: unresolvable field type: ResolutionRequestType
    at Error (native)
    at Field.resolve (/home/hal/git/protobuf.js/src/field.js:242:19)
    at /home/hal/git/protobuf.js/cli/targets/static.js:236:15
    at Array.forEach (native)
    at buildType (/home/hal/git/protobuf.js/cli/targets/static.js:235:22)
    at buildNamespace (/home/hal/git/protobuf.js/cli/targets/static.js:120:9)
    at /home/hal/git/protobuf.js/cli/targets/static.js:137:13
    at Array.forEach (native)
    at buildNamespace (/home/hal/git/protobuf.js/cli/targets/static.js:133:20)
    at /home/hal/git/protobuf.js/cli/targets/static.js:137:13

When I set UnknownResolutionRequestType to positive value, pbjs generates js-file successfully

In v6.3.0 there was no such errors.

@dcodeIO dcodeIO closed this in 5915ff9 Jan 3, 2017

@halex2005

This comment has been minimized.

Contributor

halex2005 commented Jan 3, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment