-
Notifications
You must be signed in to change notification settings - Fork 2
/
contracts.proto
183 lines (163 loc) · 3.42 KB
/
contracts.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
syntax = "proto3";
package leancode.contracts;
option csharp_namespace = "LeanCode.ContractsGenerator";
enum KnownType {
Object = 0;
String = 1;
Guid = 3;
Uri = 4;
Boolean = 5;
UInt8 = 100;
Int8 = 101;
Int16 = 102;
UInt16 = 103;
Int32 = 104;
UInt32 = 105;
Int64 = 106;
UInt64 = 107;
Float32 = 150;
Float64 = 151;
DateOnly = 200;
TimeOnly = 201;
DateTimeOffset = 202;
TimeSpan = 203;
Array = 300;
Map = 301;
Query = 1000;
Command = 1001;
CommandResult = 1002;
Operation = 1003;
Binary = 1004;
Topic = 1005;
Attribute = 1100;
AuthorizeWhenAttribute = 1101;
AuthorizeWhenHasAnyOfAttribute = 1102;
}
message ValueRef {
message Null {}
message Number { int64 value = 1; }
message FloatingPointNumber { double value = 1; }
message String { string value = 1; }
message Boolean { bool value = 1; }
oneof value {
Null null = 1;
Number number = 2;
FloatingPointNumber floatingPoint = 3;
String string = 4;
Boolean bool = 5;
}
}
message TypeRef {
message Generic { string name = 1; }
message Internal {
string name = 1;
repeated TypeRef arguments = 2;
}
message Known {
KnownType type = 1;
repeated TypeRef arguments = 2;
}
bool nullable = 1;
oneof type {
Generic generic = 2;
Internal internal = 3;
Known known = 4;
}
}
message NotificationTypeRef {
TypeRef type = 1;
string tag = 2;
}
message GenericParameter { string name = 1; }
message AttributeArgument {
message Positional {
int32 position = 1;
ValueRef value = 2;
}
message Named {
string name = 1;
ValueRef value = 2;
}
oneof attribute {
Positional positional = 1;
Named named = 2;
}
}
message AttributeRef {
string attributeName = 1;
repeated AttributeArgument argument = 2;
}
message PropertyRef {
TypeRef type = 1;
string name = 2;
repeated AttributeRef attributes = 3;
string comment = 4;
}
message ConstantRef {
string name = 1;
ValueRef value = 2;
string comment = 3;
}
message EnumValue {
string name = 1;
int64 value = 2;
string comment = 3;
repeated AttributeRef attributes = 4;
}
message ErrorCode {
message Single {
string name = 1;
int32 code = 2;
}
message Group {
string name = 1;
string groupId = 2;
repeated ErrorCode innerCodes = 3;
}
oneof code {
Single single = 1;
Group group = 2;
}
}
message TypeDescriptor {
repeated TypeRef extends = 1;
repeated GenericParameter genericParameters = 2;
repeated PropertyRef properties = 3;
repeated ConstantRef constants = 4;
}
message Statement {
message DTO { TypeDescriptor typeDescriptor = 1; }
message Enum { repeated EnumValue members = 1; }
message Query {
TypeDescriptor typeDescriptor = 1;
TypeRef returnType = 2;
}
message Command {
TypeDescriptor typeDescriptor = 1;
repeated ErrorCode errorCodes = 2;
}
message Operation {
TypeDescriptor typeDescriptor = 1;
TypeRef returnType = 2;
}
message Topic {
TypeDescriptor typeDescriptor = 1;
repeated NotificationTypeRef notifications = 2;
}
string name = 1;
string comment = 2;
repeated AttributeRef attributes = 3;
oneof content {
DTO dto = 10;
Enum enum = 11;
Query query = 12;
Command command = 13;
Operation operation = 14;
Topic topic = 15;
}
}
message Export {
string projectName = 1;
repeated Statement statements = 2;
repeated ErrorCode.Group knownErrorGroups = 3;
}