decl.proto 2.2 KB

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