File: non_standard_names.proto

package info (click to toggle)
golang-github-grpc-ecosystem-grpc-gateway 2.20.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,236 kB
  • sloc: javascript: 357; makefile: 147; sh: 26
file content (82 lines) | stat: -rw-r--r-- 2,536 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
syntax = "proto3";

package grpc.gateway.runtime.internal.examplepb;

import "google/api/annotations.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/struct.proto";

option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb";

// NonStandardMessage has oddly named fields.
message NonStandardMessage {
  // Id represents the message identifier.
  string id = 1;
  int64 Num = 2;
  int64 line_num = 3;
  string langIdent = 4;
  string STATUS = 5;
  int64 en_GB = 6;
  string no = 7;

  message Thing {
    message SubThing {
      string sub_value = 1;
    }
    SubThing subThing = 1;
  }
  Thing thing = 8;
  google.protobuf.Struct struct_field = 9;
  google.protobuf.Value value_field = 10;
}

message NonStandardUpdateRequest {
  NonStandardMessage body = 1;
  google.protobuf.FieldMask update_mask = 2;
}

// NonStandardMessageWithJSONNames maps odd field names to odd JSON names for maximum confusion.
message NonStandardMessageWithJSONNames {
  // Id represents the message identifier.
  string id = 1 [json_name = "ID"];
  int64 Num = 2 [json_name = "Num"];
  int64 line_num = 3 [json_name = "LineNum"];
  string langIdent = 4 [json_name = "langIdent"];
  string STATUS = 5 [json_name = "status"];
  int64 en_GB = 6 [json_name = "En_GB"];
  string no = 7 [json_name = "yes"];

  message Thing {
    message SubThing {
      string sub_value = 1 [json_name = "sub_Value"];
    }
    SubThing subThing = 1 [json_name = "SubThing"];
  }
  Thing thing = 8 [json_name = "Thingy"];
  google.protobuf.Struct struct_field = 9 [json_name = "StructField"];
  google.protobuf.Value value_field = 10 [json_name = "ValueField"];
}

message NonStandardWithJSONNamesUpdateRequest {
  NonStandardMessageWithJSONNames body = 1;
  google.protobuf.FieldMask update_mask = 2;
}

// NonStandardService responds to incoming messages, applies a field mask and returns the masked response.
service NonStandardService {
  // Apply field mask to empty NonStandardMessage and return result.
  rpc Update(NonStandardUpdateRequest) returns (NonStandardMessage) {
    option (google.api.http) = {
      patch: "/v1/example/non_standard/update"
      body: "body"
    };
  }

  // Apply field mask to empty NonStandardMessageWithJSONNames and return result.
  rpc UpdateWithJSONNames(NonStandardWithJSONNamesUpdateRequest) returns (NonStandardMessageWithJSONNames) {
    option (google.api.http) = {
      patch: "/v1/example/non_standard/update_with_json_names"
      body: "body"
    };
  }
}