-
Notifications
You must be signed in to change notification settings - Fork 146
/
test.proto
53 lines (45 loc) · 1.28 KB
/
test.proto
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
syntax = "proto3";
package pb;
option go_package = "/pb";
import "google/protobuf/any.proto";
import "google/protobuf/empty.proto";
message IP {
string Address = 1; // @inject_tag: valid:"ip" yaml:"ip" json:"overrided"
}
message URL {
// below is an example where the line-specific comment should take precedence
// over the "doc" comment, which is known to be more free-form. On the
// resulting struct field, you should see `valid:"http|https"` added, not
// `valid:"-"`.
//
// @inject_tag: valid:"-"
string scheme = 1; // @inject_tag: valid:"http|https"
string url = 2;
// @inject_tag: valid:"nonzero"
int32 port = 3;
}
service StreamService {
rpc GetRecords(Params) returns (stream Record) {}
}
message Params {
// @inject_tag: validate:"omitempty"
string id = 1;
// gets converted into XXX_Deprecated, for use with testing pre-v1.4.x protoc-gen-go
// functionality that exposes unknown fields as public.
string XXX__deprecated = 2;
}
message Record {
// @inject_tag: validate:"omitempty"
string id = 1;
google.protobuf.Any test_any = 2;
google.protobuf.Empty test_empty = 3;
}
message OneOfObject {
// @inject_tag: tag:"foo_bar"
oneof foo_bar {
// @inject_tag: tag:"foo"
string foo = 1;
// @inject_tag: tag:"bar"
int64 bar = 2;
}
}