Skip to content

Commit f889ce6

Browse files
[protobuf] Update protobuf definitions to v1.30.1 (#364)
Signed-off-by: envoy-bot <[email protected]> Co-authored-by: envoy-bot <[email protected]>
1 parent d0af036 commit f889ce6

File tree

74 files changed

+3196
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+3196
-202
lines changed
+344
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,344 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package cel.expr;
18+
19+
import "cel/expr/syntax.proto";
20+
import "google/protobuf/empty.proto";
21+
import "google/protobuf/struct.proto";
22+
23+
option cc_enable_arenas = true;
24+
option go_package = "cel.dev/expr";
25+
option java_multiple_files = true;
26+
option java_outer_classname = "DeclProto";
27+
option java_package = "dev.cel.expr";
28+
29+
// Protos for representing CEL declarations and typed checked expressions.
30+
31+
// A CEL expression which has been successfully type checked.
32+
message CheckedExpr {
33+
// A map from expression ids to resolved references.
34+
//
35+
// The following entries are in this table:
36+
//
37+
// - An Ident or Select expression is represented here if it resolves to a
38+
// declaration. For instance, if `a.b.c` is represented by
39+
// `select(select(id(a), b), c)`, and `a.b` resolves to a declaration,
40+
// while `c` is a field selection, then the reference is attached to the
41+
// nested select expression (but not to the id or or the outer select).
42+
// In turn, if `a` resolves to a declaration and `b.c` are field selections,
43+
// the reference is attached to the ident expression.
44+
// - Every Call expression has an entry here, identifying the function being
45+
// called.
46+
// - Every CreateStruct expression for a message has an entry, identifying
47+
// the message.
48+
map<int64, Reference> reference_map = 2;
49+
50+
// A map from expression ids to types.
51+
//
52+
// Every expression node which has a type different than DYN has a mapping
53+
// here. If an expression has type DYN, it is omitted from this map to save
54+
// space.
55+
map<int64, Type> type_map = 3;
56+
57+
// The source info derived from input that generated the parsed `expr` and
58+
// any optimizations made during the type-checking pass.
59+
SourceInfo source_info = 5;
60+
61+
// The expr version indicates the major / minor version number of the `expr`
62+
// representation.
63+
//
64+
// The most common reason for a version change will be to indicate to the CEL
65+
// runtimes that transformations have been performed on the expr during static
66+
// analysis. In some cases, this will save the runtime the work of applying
67+
// the same or similar transformations prior to evaluation.
68+
string expr_version = 6;
69+
70+
// The checked expression. Semantically equivalent to the parsed `expr`, but
71+
// may have structural differences.
72+
Expr expr = 4;
73+
}
74+
75+
// Represents a CEL type.
76+
message Type {
77+
// List type with typed elements, e.g. `list<example.proto.MyMessage>`.
78+
message ListType {
79+
// The element type.
80+
Type elem_type = 1;
81+
}
82+
83+
// Map type with parameterized key and value types, e.g. `map<string, int>`.
84+
message MapType {
85+
// The type of the key.
86+
Type key_type = 1;
87+
88+
// The type of the value.
89+
Type value_type = 2;
90+
}
91+
92+
// Function type with result and arg types.
93+
message FunctionType {
94+
// Result type of the function.
95+
Type result_type = 1;
96+
97+
// Argument types of the function.
98+
repeated Type arg_types = 2;
99+
}
100+
101+
// Application defined abstract type.
102+
message AbstractType {
103+
// The fully qualified name of this abstract type.
104+
string name = 1;
105+
106+
// Parameter types for this abstract type.
107+
repeated Type parameter_types = 2;
108+
}
109+
110+
// CEL primitive types.
111+
enum PrimitiveType {
112+
// Unspecified type.
113+
PRIMITIVE_TYPE_UNSPECIFIED = 0;
114+
115+
// Boolean type.
116+
BOOL = 1;
117+
118+
// Int64 type.
119+
//
120+
// 32-bit integer values are widened to int64.
121+
INT64 = 2;
122+
123+
// Uint64 type.
124+
//
125+
// 32-bit unsigned integer values are widened to uint64.
126+
UINT64 = 3;
127+
128+
// Double type.
129+
//
130+
// 32-bit float values are widened to double values.
131+
DOUBLE = 4;
132+
133+
// String type.
134+
STRING = 5;
135+
136+
// Bytes type.
137+
BYTES = 6;
138+
}
139+
140+
// Well-known protobuf types treated with first-class support in CEL.
141+
enum WellKnownType {
142+
// Unspecified type.
143+
WELL_KNOWN_TYPE_UNSPECIFIED = 0;
144+
145+
// Well-known protobuf.Any type.
146+
//
147+
// Any types are a polymorphic message type. During type-checking they are
148+
// treated like `DYN` types, but at runtime they are resolved to a specific
149+
// message type specified at evaluation time.
150+
ANY = 1;
151+
152+
// Well-known protobuf.Timestamp type, internally referenced as `timestamp`.
153+
TIMESTAMP = 2;
154+
155+
// Well-known protobuf.Duration type, internally referenced as `duration`.
156+
DURATION = 3;
157+
}
158+
159+
// The kind of type.
160+
oneof type_kind {
161+
// Dynamic type.
162+
google.protobuf.Empty dyn = 1;
163+
164+
// Null value.
165+
google.protobuf.NullValue null = 2;
166+
167+
// Primitive types: `true`, `1u`, `-2.0`, `'string'`, `b'bytes'`.
168+
PrimitiveType primitive = 3;
169+
170+
// Wrapper of a primitive type, e.g. `google.protobuf.Int64Value`.
171+
PrimitiveType wrapper = 4;
172+
173+
// Well-known protobuf type such as `google.protobuf.Timestamp`.
174+
WellKnownType well_known = 5;
175+
176+
// Parameterized list with elements of `list_type`, e.g. `list<timestamp>`.
177+
ListType list_type = 6;
178+
179+
// Parameterized map with typed keys and values.
180+
MapType map_type = 7;
181+
182+
// Function type.
183+
FunctionType function = 8;
184+
185+
// Protocol buffer message type.
186+
//
187+
// The `message_type` string specifies the qualified message type name. For
188+
// example, `google.type.PhoneNumber`.
189+
string message_type = 9;
190+
191+
// Type param type.
192+
//
193+
// The `type_param` string specifies the type parameter name, e.g. `list<E>`
194+
// would be a `list_type` whose element type was a `type_param` type
195+
// named `E`.
196+
string type_param = 10;
197+
198+
// Type type.
199+
//
200+
// The `type` value specifies the target type. e.g. int is type with a
201+
// target type of `Primitive.INT64`.
202+
Type type = 11;
203+
204+
// Error type.
205+
//
206+
// During type-checking if an expression is an error, its type is propagated
207+
// as the `ERROR` type. This permits the type-checker to discover other
208+
// errors present in the expression.
209+
google.protobuf.Empty error = 12;
210+
211+
// Abstract, application defined type.
212+
//
213+
// An abstract type has no accessible field names, and it can only be
214+
// inspected via helper / member functions.
215+
AbstractType abstract_type = 14;
216+
}
217+
}
218+
219+
// Represents a declaration of a named value or function.
220+
//
221+
// A declaration is part of the contract between the expression, the agent
222+
// evaluating that expression, and the caller requesting evaluation.
223+
message Decl {
224+
// Identifier declaration which specifies its type and optional `Expr` value.
225+
//
226+
// An identifier without a value is a declaration that must be provided at
227+
// evaluation time. An identifier with a value should resolve to a constant,
228+
// but may be used in conjunction with other identifiers bound at evaluation
229+
// time.
230+
message IdentDecl {
231+
// Required. The type of the identifier.
232+
Type type = 1;
233+
234+
// The constant value of the identifier. If not specified, the identifier
235+
// must be supplied at evaluation time.
236+
Constant value = 2;
237+
238+
// Documentation string for the identifier.
239+
string doc = 3;
240+
}
241+
242+
// Function declaration specifies one or more overloads which indicate the
243+
// function's parameter types and return type.
244+
//
245+
// Functions have no observable side-effects (there may be side-effects like
246+
// logging which are not observable from CEL).
247+
message FunctionDecl {
248+
// An overload indicates a function's parameter types and return type, and
249+
// may optionally include a function body described in terms of
250+
// [Expr][cel.expr.Expr] values.
251+
//
252+
// Functions overloads are declared in either a function or method
253+
// call-style. For methods, the `params[0]` is the expected type of the
254+
// target receiver.
255+
//
256+
// Overloads must have non-overlapping argument types after erasure of all
257+
// parameterized type variables (similar as type erasure in Java).
258+
message Overload {
259+
// Required. Globally unique overload name of the function which reflects
260+
// the function name and argument types.
261+
//
262+
// This will be used by a [Reference][cel.expr.Reference] to
263+
// indicate the `overload_id` that was resolved for the function `name`.
264+
string overload_id = 1;
265+
266+
// List of function parameter [Type][cel.expr.Type] values.
267+
//
268+
// Param types are disjoint after generic type parameters have been
269+
// replaced with the type `DYN`. Since the `DYN` type is compatible with
270+
// any other type, this means that if `A` is a type parameter, the
271+
// function types `int<A>` and `int<int>` are not disjoint. Likewise,
272+
// `map<string, string>` is not disjoint from `map<K, V>`.
273+
//
274+
// When the `result_type` of a function is a generic type param, the
275+
// type param name also appears as the `type` of on at least one params.
276+
repeated Type params = 2;
277+
278+
// The type param names associated with the function declaration.
279+
//
280+
// For example, `function ex<K,V>(K key, map<K, V> map) : V` would yield
281+
// the type params of `K, V`.
282+
repeated string type_params = 3;
283+
284+
// Required. The result type of the function. For example, the operator
285+
// `string.isEmpty()` would have `result_type` of `kind: BOOL`.
286+
Type result_type = 4;
287+
288+
// Whether the function is to be used in a method call-style `x.f(...)`
289+
// of a function call-style `f(x, ...)`.
290+
//
291+
// For methods, the first parameter declaration, `params[0]` is the
292+
// expected type of the target receiver.
293+
bool is_instance_function = 5;
294+
295+
// Documentation string for the overload.
296+
string doc = 6;
297+
}
298+
299+
// Required. List of function overloads, must contain at least one overload.
300+
repeated Overload overloads = 1;
301+
}
302+
303+
// The fully qualified name of the declaration.
304+
//
305+
// Declarations are organized in containers and this represents the full path
306+
// to the declaration in its container, as in `cel.expr.Decl`.
307+
//
308+
// Declarations used as
309+
// [FunctionDecl.Overload][cel.expr.Decl.FunctionDecl.Overload]
310+
// parameters may or may not have a name depending on whether the overload is
311+
// function declaration or a function definition containing a result
312+
// [Expr][cel.expr.Expr].
313+
string name = 1;
314+
315+
// Required. The declaration kind.
316+
oneof decl_kind {
317+
// Identifier declaration.
318+
IdentDecl ident = 2;
319+
320+
// Function declaration.
321+
FunctionDecl function = 3;
322+
}
323+
}
324+
325+
// Describes a resolved reference to a declaration.
326+
message Reference {
327+
// The fully qualified name of the declaration.
328+
string name = 1;
329+
330+
// For references to functions, this is a list of `Overload.overload_id`
331+
// values which match according to typing rules.
332+
//
333+
// If the list has more than one element, overload resolution among the
334+
// presented candidates must happen at runtime because of dynamic types. The
335+
// type checker attempts to narrow down this list as much as possible.
336+
//
337+
// Empty if this is not a reference to a
338+
// [Decl.FunctionDecl][cel.expr.Decl.FunctionDecl].
339+
repeated string overload_id = 3;
340+
341+
// For references to constants, this may contain the value of the
342+
// constant if known at compile time.
343+
Constant value = 4;
344+
}

0 commit comments

Comments
 (0)