You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enum WidgetColor {
RED = 0;
BLUE = 1;
}
message PaintRequest {
int32 id = 1;
WidgetColor color = 2;
}
service WidgetService {
rpc paint(PaintRequest) returns Empty;
}
There are some considerations:
The values must be int32 values, and there must be a zero value (which is implied to be the default value), so we would likely require Cadl enums to explicitly specify integral values to use them in gRPC emit.
We could also provide a template or decorator to "gRPC-ify" an enum.
The zero value is required to be the first value in the enum for proto2 compatibility reasons.
Protobuf enums support an option called allow_alias (off by default) that will permit multiple keys of the enum to refer to the same integral value.
gRPC priority: 2
Estimate: 3
It should be relatively straightforward to do a basic mapping between CADL enum and Protobuf, but the devil is in the details.
Activity
witemple-msft commentedon Jun 21, 2022
gRPC priority: 2
Estimate: 3
It should be relatively straightforward to do a basic mapping between CADL enum and Protobuf, but the devil is in the details.