1// Copyright 2019 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 16syntax = "proto3"; 17 18package google.api.expr.v1beta1; 19 20import "google/api/expr/v1beta1/expr.proto"; 21 22option cc_enable_arenas = true; 23option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr"; 24option java_multiple_files = true; 25option java_outer_classname = "DeclProto"; 26option java_package = "com.google.api.expr.v1beta1"; 27 28// A declaration. 29message Decl { 30 // The id of the declaration. 31 int32 id = 1; 32 33 // The name of the declaration. 34 string name = 2; 35 36 // The documentation string for the declaration. 37 string doc = 3; 38 39 // The kind of declaration. 40 oneof kind { 41 // An identifier declaration. 42 IdentDecl ident = 4; 43 44 // A function declaration. 45 FunctionDecl function = 5; 46 } 47} 48 49// The declared type of a variable. 50// 51// Extends runtime type values with extra information used for type checking 52// and dispatching. 53message DeclType { 54 // The expression id of the declared type, if applicable. 55 int32 id = 1; 56 57 // The type name, e.g. 'int', 'my.type.Type' or 'T' 58 string type = 2; 59 60 // An ordered list of type parameters, e.g. `<string, int>`. 61 // Only applies to a subset of types, e.g. `map`, `list`. 62 repeated DeclType type_params = 4; 63} 64 65// An identifier declaration. 66message IdentDecl { 67 // Optional type of the identifier. 68 DeclType type = 3; 69 70 // Optional value of the identifier. 71 Expr value = 4; 72} 73 74// A function declaration. 75message FunctionDecl { 76 // The function arguments. 77 repeated IdentDecl args = 1; 78 79 // Optional declared return type. 80 DeclType return_type = 2; 81 82 // If the first argument of the function is the receiver. 83 bool receiver_function = 3; 84} 85