File tree 1 file changed +34
-7
lines changed
1 file changed +34
-7
lines changed Original file line number Diff line number Diff line change 1
- # Unary(Simple) gRPC sample
1
+ # Enum compatibility check
2
+ ## Premise
3
+ Old proto is following.
2
4
3
- ## Compile
5
+ ``` proto
6
+ message HelloReply {
7
+ string message = 1;
8
+ enum Role {
9
+ NONE = 0;
10
+ STANDARD = 1;
11
+ PREMIUM = 2;
12
+ ULTIMATE = 3;
13
+ }
14
+ Role role = 2;
15
+ }
4
16
```
5
- make proto
17
+
18
+ Then I update like this.
19
+ ``` proto
20
+ message HelloReply {
21
+ string message = 1;
22
+ RoleType role = 2;
23
+ }
24
+
25
+ enum RoleType {
26
+ NONE = 0;
27
+ STANDARD = 1;
28
+ PREMIUM = 2;
29
+ ULTIMATE = 3;
30
+ }
6
31
```
7
32
8
- ## Run gRPC server
9
- Server depends on new enum proto.
33
+ ## Confirm behaviour
34
+ ### Run gRPC server
35
+ Server depends on new enum proto `` RoleType `` .
10
36
```
11
37
go run server/main.go
12
38
```
13
39
14
- ## Run gRRC Client
15
- Client depends on old enum proto.
40
+ ### Run gRRC Client
41
+ Client depends on old enum proto `` HelloReply.Role `` .
16
42
```
17
43
go run client/main.go
18
44
```
19
45
46
+ ### Result
20
47
Then it returns
21
48
```
22
49
2024/11/13 08:50:49 Reply: Hello alice
You can’t perform that action at this time.
0 commit comments