-
Notifications
You must be signed in to change notification settings - Fork 150
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
Proposed updates to support required and optional enumerations. #49
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try and look at functions.yaml in more detail later (but don't wait for me)
message Enum { | ||
oneof enum_kind { | ||
string specified = 1; | ||
Empty unspecified = 2; | ||
} | ||
|
||
message Empty {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message Enum { | |
oneof enum_kind { | |
string specified = 1; | |
Empty unspecified = 2; | |
} | |
message Empty {} | |
} | |
message Enum { | |
optional string value = 1; | |
} |
Maybe I'm misunderstanding protobof?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do this but it makes thing more implicit. The way I've done it makes it clearer (albeit slightly larger on the wire). Optional is implicit in pb3 so doesn't have to be stated. The union also allows us to introduce more than two options later.
The other nice thing is that the "enum_kind" becomes something to switch off of in several languages.
Co-authored-by: Weston Pace <weston.pace@gmail.com>
d0627e8
to
71d3488
Compare
No description provided.