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

Enum with index 0 cannot be returned #95

Closed
nituis opened this issue Mar 29, 2019 · 1 comment
Closed

Enum with index 0 cannot be returned #95

nituis opened this issue Mar 29, 2019 · 1 comment

Comments

@nituis
Copy link

nituis commented Mar 29, 2019

grpcurl version: 1.1.0
proto3 is used

Case:
enum Status {
ACTIVE = 0;
INACTIVE = 1;
}

if Status is INACTIVE, return:
{
"status": "INACTIVE"
}

if Status is ACTIVE, return: {}
which should return
{
"status": "ACTIVE"
}

@jhump
Copy link
Contributor

jhump commented Mar 29, 2019

This is behaving as intended. Per the protobuf spec for the JSON format:

If a field has the default value in the protocol buffer, it will be omitted in the JSON-encoded data by default to save space.

You can change this behavior by providing the -emit-defaults flag, in which case default values will be explicitly included in the output (including for enum values).

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