grpc-ecosystem/grpc-gateway

Inconsistent enum behaviour

Open

#354 opened on Apr 13, 2017

View on GitHub
 (1 comment) (2 reactions) (0 assignees)Go (2,250 forks)batch import
help wanted

Repository metrics

Stars
 (16,971 stars)
PR merge metrics
 (Avg merge 8d 23h) (147 merged PRs in 30d)

Description

Given the following messages and enumeration:

message NameCheckResponse {
    Result result = 1;
}

message MultiNameCheckResponse {
    map<string, Result> results = 1;
}

enum Result {
    AVAILABLE = 0;
    UNAVAILABLE = 1;
    UNKOWN = 2;
}

The returned value in case of the first message is the name of the enum. In the second case, it's the numeric value.

Is this behaviour intended?

Contributor guide