UNPKG

@bufbuild/cel-spec

Version:

CEL definitions and test data

296 lines (295 loc) 9.55 kB
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; import type { Type } from "../../checked_pb.js"; import type { ErrorSet, UnknownSet } from "../../eval_pb.js"; import type { Value } from "../../value_pb.js"; import type { Environment } from "../env_config_pb.js"; import type { Any } from "@bufbuild/protobuf/wkt"; import type { Message } from "@bufbuild/protobuf"; /** * Describes the file cel/expr/conformance/test/suite.proto. */ export declare const file_cel_expr_conformance_test_suite: GenFile; /** * A test suite is a collection of tests designed to evaluate the correctness of * a CEL policy, a CEL expression or the conformance of a CEL implementation to * the standard specification. * * @generated from message cel.expr.conformance.test.TestSuite */ export type TestSuite = Message<"cel.expr.conformance.test.TestSuite"> & { /** * The name of the test suite. * * @generated from field: string name = 1; */ name: string; /** * Description of the test suite. * * @generated from field: string description = 2; */ description: string; /** * Test sections of the test suite. * Each section represents a behavior to be tested. * * @generated from field: repeated cel.expr.conformance.test.TestSection sections = 3; */ sections: TestSection[]; }; /** * Describes the message cel.expr.conformance.test.TestSuite. * Use `create(TestSuiteSchema)` to create a new message. */ export declare const TestSuiteSchema: GenMessage<TestSuite>; /** * A collection of related test cases. * * @generated from message cel.expr.conformance.test.TestSection */ export type TestSection = Message<"cel.expr.conformance.test.TestSection"> & { /** * Name of the test section. * * @generated from field: string name = 1; */ name: string; /** * Description of the test section. * * @generated from field: string description = 2; */ description: string; /** * Test cases of the test section. * Each test case represents a test scenario. * * @generated from field: repeated cel.expr.conformance.test.TestCase tests = 3; */ tests: TestCase[]; }; /** * Describes the message cel.expr.conformance.test.TestSection. * Use `create(TestSectionSchema)` to create a new message. */ export declare const TestSectionSchema: GenMessage<TestSection>; /** * A test to validate a CEL policy or expression. The test case encompasses * evaluation of the compiled expression using the provided input bindings and * asserting the result against the expected result. * It can also validate a raw CEL expression string through parse, check and * eval stages, making use of the augmenting CEL environment if provided. * * @generated from message cel.expr.conformance.test.TestCase */ export type TestCase = Message<"cel.expr.conformance.test.TestCase"> & { /** * Name of the test case. * * @generated from field: string name = 1; */ name: string; /** * A description of the test. * * @generated from field: string description = 2; */ description: string; /** * The text of the CEL expression. * * @generated from field: string expr = 3; */ expr: string; /** * Serialized environment to be used for compilation and evaluation of the * CEL expression for the current test case. * This option allows validating the same expression against multiple * environments. * * @generated from field: cel.expr.conformance.Environment env = 4; */ env?: Environment; /** * A map representing a variable binding where the key is the name of the * input variable. * * @generated from field: map<string, cel.expr.conformance.test.InputValue> input = 5; */ input: { [key: string]: InputValue; }; /** * Input in the form of a context proto for the test case. * Note: Only one of `input_bindings` and `input_context` can be provided. Providing * both should result in an error. * * @generated from field: cel.expr.conformance.test.InputContext input_context = 6; */ inputContext?: InputContext; /** * Expected result of the test case. * * @generated from field: cel.expr.conformance.test.TestOutput output = 7; */ output?: TestOutput; /** * If specified validates that the deduced type at check time matches * If the result kind is not set and this field is set, the test is considered * "check-only". * * @generated from field: cel.expr.Type deduced_type = 8; */ deducedType?: Type; /** * Bypass the type-checking and only attempt to evaluate the parsed * expression. * * @generated from field: bool disable_check = 9; */ disableCheck: boolean; }; /** * Describes the message cel.expr.conformance.test.TestCase. * Use `create(TestCaseSchema)` to create a new message. */ export declare const TestCaseSchema: GenMessage<TestCase>; /** * Input context proto for the test case * * @generated from message cel.expr.conformance.test.InputContext */ export type InputContext = Message<"cel.expr.conformance.test.InputContext"> & { /** * The type of input context for the test case * * @generated from oneof cel.expr.conformance.test.InputContext.input_context_kind */ inputContextKind: { /** * A context message represents an input kind in the form of a proto * message whose type is defined at runtime. * * @generated from field: google.protobuf.Any context_message = 1; */ value: Any; case: "contextMessage"; } | { /** * A context expression representing a context proto variable. The * fields of the input proto.Messages are used as top-level variables within * an Activation. The expression is evaluated using the cel environment * configured for the test suite. * * @generated from field: string context_expr = 2; */ value: string; case: "contextExpr"; } | { case: undefined; value?: undefined; }; }; /** * Describes the message cel.expr.conformance.test.InputContext. * Use `create(InputContextSchema)` to create a new message. */ export declare const InputContextSchema: GenMessage<InputContext>; /** * The input value for a variable binding * * @generated from message cel.expr.conformance.test.InputValue */ export type InputValue = Message<"cel.expr.conformance.test.InputValue"> & { /** * The type of input value that can be used for a variable binding * * @generated from oneof cel.expr.conformance.test.InputValue.kind */ kind: { /** * A simple literal value for a variable binding * * @generated from field: cel.expr.Value value = 1; */ value: Value; case: "value"; } | { /** * An expression which evaluates to the value of the variable binding. * The expression is evaluated using the same runtime environment as the * one used for evaluating the expression under test. * * @generated from field: string expr = 2; */ value: string; case: "expr"; } | { case: undefined; value?: undefined; }; }; /** * Describes the message cel.expr.conformance.test.InputValue. * Use `create(InputValueSchema)` to create a new message. */ export declare const InputValueSchema: GenMessage<InputValue>; /** * Expected result of the test case. * * @generated from message cel.expr.conformance.test.TestOutput */ export type TestOutput = Message<"cel.expr.conformance.test.TestOutput"> & { /** * Type of expected result of the test case. * * @generated from oneof cel.expr.conformance.test.TestOutput.result_kind */ resultKind: { /** * 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 * * @generated from field: cel.expr.Value result_value = 8; */ value: Value; case: "resultValue"; } | { /** * An expression to be evaluated using the cel environment configured for * the test suite. The result of this expression must match the result of * the test case. * * @generated from field: string result_expr = 9; */ value: string; case: "resultExpr"; } | { /** * An error evaluation result set. Success if we match all of the errors in * the set. * * @generated from field: cel.expr.ErrorSet eval_error = 10; */ value: ErrorSet; case: "evalError"; } | { /** * An unknown evaluation result. * * @generated from field: cel.expr.UnknownSet unknown = 11; */ value: UnknownSet; case: "unknown"; } | { case: undefined; value?: undefined; }; }; /** * Describes the message cel.expr.conformance.test.TestOutput. * Use `create(TestOutputSchema)` to create a new message. */ export declare const TestOutputSchema: GenMessage<TestOutput>;