Created
February 13, 2020 02:42
-
-
Save lusis/09570bdecdc3bc6dfe892e5e661722ca to your computer and use it in GitHub Desktop.
example.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3" | |
package = "com.myorg.ptypes"; | |
message User { | |
int64 id = 1; | |
UserStatus status = 2; | |
} | |
message Group { | |
int64 id = 1; | |
GroupStatus = 2; | |
} | |
// this is where the pain is | |
// because of same package scoping rules I have to duplicate the enum name or something in FRONT of the enum values | |
// there may be some overlap in the concepts but a groupstatus is inherently different than a user status | |
// having a common "status" enum that includes all possible status for either groups or users is untenable | |
// and harder to reason about | |
enum UserStatus { | |
USER_STATUS_UNKNOWN = 1; | |
USER_STATUS_ACTIVE = 2; | |
USER_STATUS_DISABLED = 3; | |
} | |
enum GroupStatus { | |
GROUP_STATUS_UNKNOWN = 1; | |
GROUP_STATUS_ACTIVE = 2; | |
GROUP_STATUS_DISABLED = 3; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment