File: simple.proto

package info (click to toggle)
golang-github-google-cel-spec 0.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 876 kB
  • sloc: sh: 11; makefile: 8
file content (107 lines) | stat: -rw-r--r-- 3,334 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// Simple end-to-end conformance tests.

syntax = "proto3";

package google.api.expr.test.v1;

// Note, run regen_go_proto.sh after making modifications to this file.
option go_package = "github.com/google/cel-spec/test/v1/testpb";

import "google/api/expr/v1alpha1/checked.proto";
import "google/api/expr/v1alpha1/eval.proto";
import "google/api/expr/v1alpha1/value.proto";

// The format of a simple test file, expected to be stored in text format.
// A file is the unit of granularity for selecting conformance tests,
// so tests of optional features should be segregated into separate files.
message SimpleTestFile {
  // Required.  The name of the file.  Should match the filename.
  string name = 1;

  // A description of the file.
  string description = 2;

  // The contained sections.
  repeated SimpleTestSection section = 3;
}

// A collection of related SimpleTests.
//
// The section is the unit of organization within a test file, and should
// guide where new tests are added.
message SimpleTestSection {
  // Required.  The name of the section.
  string name = 1;

  // A description of the section.
  string description = 2;

  // The contained tests.
  repeated SimpleTest test = 3;
}

// A test which should run the given CEL program through parsing,
// optionally through checking, then evaluation, with the results
// of the pipeline validated by the given result matcher.
message SimpleTest {
  // Required.  The name of the test, which should be unique in the test file.
  string name = 1;

  // A description of the test.
  string description = 2;

  // Required.  The text of the CEL expression.
  string expr = 3;

  // Disables all macro expansion in parsing.
  bool disable_macros = 4;

  // Disables the check phase.
  bool disable_check = 5;

  // The type environment to use for the check phase.
  repeated google.api.expr.v1alpha1.Decl type_env = 6;

  // The container for name resolution.
  string container = 13;

  // Variable bindings to use for the eval phase.
  map<string, google.api.expr.v1alpha1.ExprValue> bindings = 7;

  // An unspecified result defaults to a matcher for the true boolean value.
  oneof result_matcher {
    // A normal value, which must match the evaluation result exactly
    // via value equality semantics.  This coincides with proto equality,
    // except for:
    // *   maps are order-agnostic.
    // *   a floating point NaN should match any NaN.
    google.api.expr.v1alpha1.Value value = 8;

    // Matches error evaluation results.
    google.api.expr.v1alpha1.ErrorSet eval_error = 9;

    // Matches one of several error results.
    // (Using explicit message since oneof can't handle repeated.)
    ErrorSetMatcher any_eval_errors = 10;

    // Matches unknown evaluation results.
    google.api.expr.v1alpha1.UnknownSet unknown = 11;

    // Matches one of several unknown results.
    // (Using explicit message since oneof can't handle repeated.)
    UnknownSetMatcher any_unknowns = 12;
  }
  // Next is 14.
}

// Matches error results from Eval.
message ErrorSetMatcher {
  // Success if we match any of these sets.
  repeated google.api.expr.v1alpha1.ErrorSet errors = 1;
}

// Matches unknown results from Eval.
message UnknownSetMatcher {
  // Success if we match any of these sets.
  repeated google.api.expr.v1alpha1.UnknownSet unknowns = 1;
}