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

Mesage.verify failed to validate enum, when grpc server decode enum to string #918

Open
muz3 opened this issue Sep 28, 2017 · 0 comments
Open

Comments

@muz3
Copy link

muz3 commented Sep 28, 2017

protobuf.js version: v6.8.0

I have searched here and grpc issues list, and see some related post, but none with an answer. so I posted my question here.

I have grpc server use the grpc/node library. when it received bytes contains enum. tt converts enum to string. it caused protobuf.js Message.verify() to fail. I use verify as an input validation mechnism. Looks like the verify method is looking for int32. Lets say I have the following proto file.

when I send a user object like
{
Id: '1',
Status: 1
}

I will receive on my grpc server as
{
Id: '1',
Status: 'Inactive'
}

then I use verify() to validate the message, it will return error message like 'Status: enum value expected', so is there a way to by pass this issue still with the verify method. Any input would be appreciated.

proto.file

syntax = "proto3";
package test;

message User {
string Id = 1 ;
UserStatus Status = 4;
}

enum UserStatus {
Active = 0;
Inactive = 1;
}

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