Skip to content

Commit 9679873

Browse files
Google APIscopybara-github
authored andcommitted
fix: Update doc comments
fix: Move conformance_service.proto to its own directory to mirror existing go package structure. feat: Publish an `expr_version` field to track transformations applied during static analysis to the `expr` field within the `CheckedExpr`. Committer: @TristonianJones PiperOrigin-RevId: 404145648
1 parent 8ef531e commit 9679873

8 files changed

Lines changed: 234 additions & 117 deletions

File tree

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# This file was automatically generated by BuildFileGenerator
2+
3+
# This is an API workspace, having public visibility by default makes perfect sense.
4+
package(default_visibility = ["//visibility:public"])
5+
6+
##############################################################################
7+
# Common
8+
##############################################################################
9+
load("@rules_proto//proto:defs.bzl", "proto_library")
10+
11+
proto_library(
12+
name = "conformance_proto",
13+
srcs = [
14+
"conformance_service.proto",
15+
],
16+
deps = [
17+
"//google/api/expr/v1alpha1:checked_proto",
18+
"//google/api/expr/v1alpha1:eval_proto",
19+
"//google/api/expr/v1alpha1:syntax_proto",
20+
"//google/api:client_proto",
21+
"//google/rpc:status_proto",
22+
],
23+
)
24+
25+
##############################################################################
26+
# Java
27+
##############################################################################
28+
load(
29+
"@com_google_googleapis_imports//:imports.bzl",
30+
"java_grpc_library",
31+
"java_proto_library",
32+
)
33+
34+
java_proto_library(
35+
name = "conformance_java_proto",
36+
deps = [":conformance_proto"],
37+
)
38+
39+
java_grpc_library(
40+
name = "conformance_java_grpc",
41+
srcs = [":conformance_proto"],
42+
deps = [":conformance_java_proto"],
43+
)
44+
45+
##############################################################################
46+
# Go
47+
##############################################################################
48+
load(
49+
"@com_google_googleapis_imports//:imports.bzl",
50+
"go_proto_library",
51+
)
52+
53+
go_proto_library(
54+
name = "conformance_go_proto",
55+
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
56+
importpath = "google.golang.org/genproto/googleapis/api/expr/conformance/v1alpha1",
57+
protos = [":conformance_proto"],
58+
deps = [
59+
"//google/api/expr/v1alpha1:expr_go_proto",
60+
"//google/api:annotations_go_proto",
61+
"//google/rpc:status_go_proto",
62+
],
63+
)
64+
65+
##############################################################################
66+
# Python
67+
##############################################################################
68+
load(
69+
"@com_google_googleapis_imports//:imports.bzl",
70+
"moved_proto_library",
71+
"py_grpc_library",
72+
"py_proto_library",
73+
)
74+
75+
moved_proto_library(
76+
name = "conformance_moved_proto",
77+
srcs = [":conformance_proto"],
78+
deps = [
79+
"//google/api/expr/v1alpha1:checked_proto",
80+
"//google/api/expr/v1alpha1:eval_proto",
81+
"//google/api/expr/v1alpha1:syntax_proto",
82+
"//google/api:client_proto",
83+
"//google/rpc:status_proto",
84+
],
85+
)
86+
87+
py_proto_library(
88+
name = "conformance_py_proto",
89+
deps = [":conformance_moved_proto"],
90+
)
91+
92+
py_grpc_library(
93+
name = "conformance_py_grpc",
94+
srcs = [":conformance_moved_proto"],
95+
deps = [":conformance_py_proto"],
96+
)
97+
98+
##############################################################################
99+
# PHP
100+
##############################################################################
101+
load(
102+
"@com_google_googleapis_imports//:imports.bzl",
103+
"php_grpc_library",
104+
"php_proto_library",
105+
)
106+
107+
php_proto_library(
108+
name = "conformance_php_proto",
109+
deps = [":conformance_proto"],
110+
)
111+
112+
php_grpc_library(
113+
name = "conformance_php_grpc",
114+
srcs = [":conformance_proto"],
115+
deps = [":conformance_php_proto"],
116+
)
117+
118+
##############################################################################
119+
# Ruby
120+
##############################################################################
121+
load(
122+
"@com_google_googleapis_imports//:imports.bzl",
123+
"ruby_grpc_library",
124+
"ruby_proto_library",
125+
)
126+
127+
ruby_proto_library(
128+
name = "conformance_ruby_proto",
129+
deps = [":conformance_proto"],
130+
)
131+
132+
ruby_grpc_library(
133+
name = "conformance_ruby_grpc",
134+
srcs = [":conformance_proto"],
135+
deps = [":conformance_ruby_proto"],
136+
)
137+
138+
##############################################################################
139+
# C#
140+
##############################################################################
141+
load(
142+
"@com_google_googleapis_imports//:imports.bzl",
143+
"csharp_grpc_library",
144+
"csharp_proto_library",
145+
)
146+
147+
csharp_proto_library(
148+
name = "conformance_csharp_proto",
149+
deps = [":conformance_proto"],
150+
)
151+
152+
csharp_grpc_library(
153+
name = "conformance_csharp_grpc",
154+
srcs = [":conformance_proto"],
155+
deps = [":conformance_csharp_proto"],
156+
)
157+
158+
##############################################################################
159+
# C++
160+
##############################################################################
161+
load(
162+
"@com_google_googleapis_imports//:imports.bzl",
163+
"cc_grpc_library",
164+
"cc_proto_library",
165+
)
166+
167+
cc_proto_library(
168+
name = "conformance_cc_proto",
169+
deps = [":conformance_proto"],
170+
)
171+
172+
cc_grpc_library(
173+
name = "conformance_cc_grpc",
174+
srcs = [":conformance_proto"],
175+
generate_mocks = True,
176+
grpc_only = True,
177+
deps = [":conformance_cc_proto"],
178+
)

google/api/expr/v1alpha1/conformance_service.proto renamed to google/api/expr/conformance/v1alpha1/conformance_service.proto

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -14,25 +14,27 @@
1414

1515
syntax = "proto3";
1616

17-
package google.api.expr.v1alpha1;
17+
package google.api.expr.conformance.v1alpha1;
1818

1919
import "google/api/expr/v1alpha1/checked.proto";
2020
import "google/api/expr/v1alpha1/eval.proto";
2121
import "google/api/expr/v1alpha1/syntax.proto";
2222
import "google/rpc/status.proto";
23+
import "google/api/client.proto";
2324

2425
option cc_enable_arenas = true;
2526
option go_package = "google.golang.org/genproto/googleapis/api/expr/conformance/v1alpha1;confpb";
2627
option java_multiple_files = true;
2728
option java_outer_classname = "ConformanceServiceProto";
28-
option java_package = "com.google.api.expr.v1alpha1";
29+
option java_package = "com.google.api.expr.conformance.v1alpha1";
2930

3031
// Access a CEL implementation from another process or machine.
3132
// A CEL implementation is decomposed as a parser, a static checker,
3233
// and an evaluator. Every CEL implementation is expected to provide
3334
// a server for this API. The API will be used for conformance testing
3435
// and other utilities.
3536
service ConformanceService {
37+
option (google.api.default_host) = "cel.googleapis.com";
3638

3739
// Transforms CEL source text into a parsed representation.
3840
rpc Parse(ParseRequest) returns (ParseResponse) {
@@ -57,7 +59,7 @@ message ParseRequest {
5759
// Tag for version of CEL syntax, for future use.
5860
string syntax_version = 2;
5961

60-
// File or resource for source text, used in [SourceInfo][google.api.expr.v1alpha1.SourceInfo].
62+
// File or resource for source text, used in [SourceInfo][google.api.SourceInfo].
6163
string source_location = 3;
6264

6365
// Prevent macro expansion. See "Macros" in Language Defiinition.
@@ -67,7 +69,7 @@ message ParseRequest {
6769
// Response message for the Parse method.
6870
message ParseResponse {
6971
// The parsed representation, or unset if parsing failed.
70-
ParsedExpr parsed_expr = 1;
72+
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
7173

7274
// Any number of issues with [StatusDetails][] as the details.
7375
repeated google.rpc.Status issues = 2;
@@ -76,18 +78,18 @@ message ParseResponse {
7678
// Request message for the Check method.
7779
message CheckRequest {
7880
// Required. The parsed representation of the CEL program.
79-
ParsedExpr parsed_expr = 1;
81+
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
8082

8183
// Declarations of types for external variables and functions.
8284
// Required if program uses external variables or functions
8385
// not in the default environment.
84-
repeated Decl type_env = 2;
86+
repeated google.api.expr.v1alpha1.Decl type_env = 2;
8587

8688
// The protocol buffer context. See "Name Resolution" in the
8789
// Language Definition.
8890
string container = 3;
8991

90-
// If true, use only the declarations in [type_env][google.api.expr.v1alpha1.CheckRequest.type_env]. If false (default),
92+
// If true, use only the declarations in [type_env][google.api.expr.conformance.v1alpha1.CheckRequest.type_env]. If false (default),
9193
// add declarations for the standard definitions to the type environment. See
9294
// "Standard Definitions" in the Language Definition.
9395
bool no_std_env = 4;
@@ -96,7 +98,7 @@ message CheckRequest {
9698
// Response message for the Check method.
9799
message CheckResponse {
98100
// The annotated representation, or unset if checking failed.
99-
CheckedExpr checked_expr = 1;
101+
google.api.expr.v1alpha1.CheckedExpr checked_expr = 1;
100102

101103
// Any number of issues with [StatusDetails][] as the details.
102104
repeated google.rpc.Status issues = 2;
@@ -107,27 +109,27 @@ message EvalRequest {
107109
// Required. Either the parsed or annotated representation of the CEL program.
108110
oneof expr_kind {
109111
// Evaluate based on the parsed representation.
110-
ParsedExpr parsed_expr = 1;
112+
google.api.expr.v1alpha1.ParsedExpr parsed_expr = 1;
111113

112114
// Evaluate based on the checked representation.
113-
CheckedExpr checked_expr = 2;
115+
google.api.expr.v1alpha1.CheckedExpr checked_expr = 2;
114116
}
115117

116118
// Bindings for the external variables. The types SHOULD be compatible
117-
// with the type environment in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked.
118-
map<string, ExprValue> bindings = 3;
119+
// with the type environment in [CheckRequest][google.api.expr.conformance.v1alpha1.CheckRequest], if checked.
120+
map<string, google.api.expr.v1alpha1.ExprValue> bindings = 3;
119121

120-
// SHOULD be the same container as used in [CheckRequest][google.api.expr.v1alpha1.CheckRequest], if checked.
122+
// SHOULD be the same container as used in [CheckRequest][google.api.expr.conformance.v1alpha1.CheckRequest], if checked.
121123
string container = 4;
122124
}
123125

124126
// Response message for the Eval method.
125127
message EvalResponse {
126128
// The execution result, or unset if execution couldn't start.
127-
ExprValue result = 1;
129+
google.api.expr.v1alpha1.ExprValue result = 1;
128130

129131
// Any number of issues with [StatusDetails][] as the details.
130-
// Note that CEL execution errors are reified into [ExprValue][google.api.expr.v1alpha1.ExprValue].
132+
// Note that CEL execution errors are reified into [ExprValue][].
131133
// Nevertheless, we'll allow out-of-band issues to be raised,
132134
// which also makes the replies more regular.
133135
repeated google.rpc.Status issues = 2;
@@ -157,8 +159,8 @@ message IssueDetails {
157159
Severity severity = 1;
158160

159161
// Position in the source, if known.
160-
SourcePosition position = 2;
162+
google.api.expr.v1alpha1.SourcePosition position = 2;
161163

162-
// Expression ID from [Expr][google.api.expr.v1alpha1.Expr], 0 if unknown.
164+
// Expression ID from [Expr][], 0 if unknown.
163165
int64 id = 3;
164166
}

0 commit comments

Comments
 (0)