...
1syntax = "proto3";
2
3package grpc.gateway.examples.internal.proto.examplepb;
4
5import "google/api/annotations.proto";
6import "google/protobuf/field_mask.proto";
7
8option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb";
9
10// NonStandardMessage has oddly named fields.
11message NonStandardMessage {
12 // Id represents the message identifier.
13 string id = 1;
14 int64 Num = 2;
15 int64 line_num = 3;
16 string langIdent = 4;
17 string STATUS = 5;
18 int64 en_GB = 6;
19 string no = 7;
20
21 message Thing {
22 message SubThing {
23 string sub_value = 1;
24 }
25 SubThing subThing = 1;
26 }
27 Thing thing = 8;
28}
29
30message NonStandardUpdateRequest {
31 NonStandardMessage body = 1;
32 google.protobuf.FieldMask update_mask = 2;
33}
34
35// NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion.
36message NonStandardMessageWithJSONNames {
37 // Id represents the message identifier.
38 string id = 1 [json_name = "ID"];
39 int64 Num = 2 [json_name = "Num"];
40 int64 line_num = 3 [json_name = "LineNum"];
41 string langIdent = 4 [json_name = "langIdent"];
42 string STATUS = 5 [json_name = "status"];
43 int64 en_GB = 6 [json_name = "En_GB"];
44 string no = 7 [json_name = "yes"];
45
46 message Thing {
47 message SubThing {
48 string sub_value = 1 [json_name = "sub_Value"];
49 }
50 SubThing subThing = 1 [json_name = "SubThing"];
51 }
52 Thing thing = 8 [json_name = "Thingy"];
53}
54
55message NonStandardWithJSONNamesUpdateRequest {
56 NonStandardMessageWithJSONNames body = 1;
57 google.protobuf.FieldMask update_mask = 2;
58}
59
60// NonStandardService responds to incoming messages, applies a field mask and returns the masked response.
61service NonStandardService {
62 // Apply field mask to empty NonStandardMessage and return result.
63 rpc Update(NonStandardUpdateRequest) returns (NonStandardMessage) {
64 option (google.api.http) = {
65 patch: "/v1/example/non_standard/update"
66 body: "body"
67 };
68 }
69
70 // Apply field mask to empty NonStandardMessageWithJSONNames and return result.
71 rpc UpdateWithJSONNames(NonStandardWithJSONNamesUpdateRequest) returns (NonStandardMessageWithJSONNames) {
72 option (google.api.http) = {
73 patch: "/v1/example/non_standard/update_with_json_names"
74 body: "body"
75 };
76 }
77}
View as plain text