-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
protogen.proto
79 lines (71 loc) · 3.41 KB
/
protogen.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
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
// utility extensions for tweaking the behavior of protogen
syntax = "proto3";
import "google/protobuf/descriptor.proto";
package protobuf_net;
option csharp_namespace = "ProtoBuf.Reflection";
extend .google.protobuf.FileOptions { ProtogenFileOptions fileopt = 1037 [(.protobuf_net.fieldopt).name = "Options"]; }
extend .google.protobuf.MessageOptions { ProtogenMessageOptions msgopt = 1037 [(.protobuf_net.fieldopt).name = "Options"]; }
extend .google.protobuf.FieldOptions { ProtogenFieldOptions fieldopt = 1037 [(.protobuf_net.fieldopt).name = "Options"]; }
extend .google.protobuf.EnumOptions { ProtogenEnumOptions enumopt = 1037 [(.protobuf_net.fieldopt).name = "Options"]; }
extend .google.protobuf.EnumValueOptions { ProtogenEnumValueOptions enumvalopt = 1037 [(.protobuf_net.fieldopt).name = "Options"]; }
extend .google.protobuf.ServiceOptions { ProtogenServiceOptions serviceopt = 1037 [(.protobuf_net.fieldopt).name = "Options"]; }
extend .google.protobuf.MethodOptions { ProtogenMethodOptions methodopt = 1037 [(.protobuf_net.fieldopt).name = "Options"]; }
extend .google.protobuf.OneofOptions { ProtogenOneofOptions oneofopt = 1037 [(.protobuf_net.fieldopt).name = "Options"]; }
enum Access {
option (.protobuf_net.enumopt) = {
access: PUBLIC
};
INHERIT = 0;
PUBLIC = 1;
PRIVATE = 2;
INTERNAL = 3;
}
message ProtogenFileOptions {
string namespace = 1;
Access access = 2;
string extensions = 3 [(.protobuf_net.fieldopt).name = "ExtensionTypeName"];
string csharp_langver = 4 [(.protobuf_net.fieldopt).name = "CSharpLanguageVersion"]; // language specific version specifier, for example "3.0" or "3" for C# 3
bool requiredDefaults = 5 [(.protobuf_net.fieldopt).name = "EmitRequiredDefaults"]; // intialize required values with their default values
bool oneofEnum = 6 [(.protobuf_net.fieldopt).name = "EmitOneOfEnum"]; // emit enums for oneof elements
string vb_langver = 7 [(.protobuf_net.fieldopt).name = "VisualBasicLanguageVersion"]; // language specific version specifier, for example "11" for VB 11
}
message ProtogenMessageOptions {
string name = 1;
Access access = 2;
string extensions = 3 [(.protobuf_net.fieldopt).name = "ExtensionTypeName"];
string namespace = 4; // optional namespace, otherwise the order is: ProtogenFileOptions.namespace, global csharp_namespace, package
MessageKind messageKind = 5; // optionally indicates that a message should be considered with some known behaviour
}
enum MessageKind {
MESSAGEKIND_NONE = 0 [(.protobuf_net.enumvalopt).name = "None"];
MESSAGEKIND_NULL_WRAPPER = 1 [(.protobuf_net.enumvalopt).name = "NullWrapper"];
// TODO: MessageKindKeyValuePair = 2;
}
message ProtogenFieldOptions {
string name = 1;
Access access = 2;
bool asRef = 3 [(.protobuf_net.fieldopt).name = "AsReference"];
bool dynamicType = 4 [(.protobuf_net.fieldopt).name = "DynamicType"];
}
message ProtogenEnumOptions {
string name = 1;
Access access = 2;
string namespace = 3; // optional namespace, otherwise the order is: ProtogenFileOptions.namespace, global csharp_namespace, package
}
message ProtogenEnumValueOptions {
string name = 1;
}
message ProtogenServiceOptions {
string name = 1;
Access access = 2;
}
message ProtogenMethodOptions {
string name = 1;
}
message ProtogenOneofOptions {
string name = 1;
bool isSubType = 2 [(.protobuf_net.fieldopt).name = "IsSubType"];
}
option (.protobuf_net.fileopt) = {
access: PUBLIC // mostly a test
};