1 // Copyright 2018 Google LLC.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 package google.api.expr.v1alpha1;
20 import "google/api/expr/v1alpha1/checked.proto";
21 import "google/api/expr/v1alpha1/eval.proto";
22 import "google/api/expr/v1alpha1/syntax.proto";
23 import "google/rpc/status.proto";
25 option cc_enable_arenas = true;
26 option go_package = "google.golang.org/genproto/googleapis/api/expr/v1alpha1;expr";
27 option java_multiple_files = true;
28 option java_outer_classname = "ConformanceServiceProto";
29 option java_package = "com.google.api.expr.v1alpha1";
31 // Access a CEL implementation from another process or machine.
32 // A CEL implementation is decomposed as a parser, a static checker,
33 // and an evaluator. Every CEL implementation is expected to provide
34 // a server for this API. The API will be used for conformance testing
35 // and other utilities.
36 service ConformanceService {
37 // Transforms CEL source text into a parsed representation.
38 rpc Parse(ParseRequest) returns (ParseResponse) {}
40 // Runs static checks on a parsed CEL representation and return
41 // an annotated representation, or a set of issues.
42 rpc Check(CheckRequest) returns (CheckResponse) {}
44 // Evaluates a parsed or annotation CEL representation given
45 // values of external bindings.
46 rpc Eval(EvalRequest) returns (EvalResponse) {}
49 // Request message for the Parse method.
50 message ParseRequest {
51 // Required. Source text in CEL syntax.
52 string cel_source = 1;
54 // Tag for version of CEL syntax, for future use.
55 string syntax_version = 2;
57 // File or resource for source text, used in
58 // [SourceInfo][google.api.expr.v1alpha1.SourceInfo].
59 string source_location = 3;
61 // Prevent macro expansion. See "Macros" in Language Defiinition.
62 bool disable_macros = 4;
65 // Response message for the Parse method.
66 message ParseResponse {
67 // The parsed representation, or unset if parsing failed.
68 ParsedExpr parsed_expr = 1;
70 // Any number of issues with [StatusDetails][] as the details.
71 repeated google.rpc.Status issues = 2;
74 // Request message for the Check method.
75 message CheckRequest {
76 // Required. The parsed representation of the CEL program.
77 ParsedExpr parsed_expr = 1;
79 // Declarations of types for external variables and functions.
80 // Required if program uses external variables or functions
81 // not in the default environment.
82 repeated Decl type_env = 2;
84 // The protocol buffer context. See "Name Resolution" in the
85 // Language Definition.
88 // If true, use only the declarations in
89 // [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false
90 // (default), add declarations for the standard definitions to the type
91 // environment. See "Standard Definitions" in the Language Definition.
95 // Response message for the Check method.
96 message CheckResponse {
97 // The annotated representation, or unset if checking failed.
98 CheckedExpr checked_expr = 1;
100 // Any number of issues with [StatusDetails][] as the details.
101 repeated google.rpc.Status issues = 2;
104 // Request message for the Eval method.
105 message EvalRequest {
106 // Required. Either the parsed or annotated representation of the CEL program.
108 // Evaluate based on the parsed representation.
109 ParsedExpr parsed_expr = 1;
111 // Evaluate based on the checked representation.
112 CheckedExpr checked_expr = 2;
115 // Bindings for the external variables. The types SHOULD be compatible
116 // with the type environment in
117 // [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked.
118 map<string, ExprValue> bindings = 3;
120 // SHOULD be the same container as used in
121 // [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked.
122 string container = 4;
125 // Response message for the Eval method.
126 message EvalResponse {
127 // The execution result, or unset if execution couldn't start.
128 ExprValue result = 1;
130 // Any number of issues with [StatusDetails][] as the details.
131 // Note that CEL execution errors are reified into
132 // [ExprValue][google.api.expr.v1alpha1.ExprValue]. Nevertheless, we'll allow
133 // out-of-band issues to be raised, which also makes the replies more regular.
134 repeated google.rpc.Status issues = 2;
137 // Warnings or errors in service execution are represented by
138 // [google.rpc.Status][google.rpc.Status] messages, with the following message
139 // in the details field.
140 message IssueDetails {
141 // Severities of issues.
143 // An unspecified severity.
144 SEVERITY_UNSPECIFIED = 0;
146 // Deprecation issue for statements and method that may no longer be
147 // supported or maintained.
150 // Warnings such as: unused variables.
153 // Errors such as: unmatched curly braces or variable redefinition.
157 // The severity of the issue.
158 Severity severity = 1;
160 // Position in the source, if known.
161 SourcePosition position = 2;
163 // Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown.