@bufbuild/cel-spec
Version:
CEL definitions and test data
277 lines (276 loc) • 8.64 kB
TypeScript
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
import type { Decl, Type } from "../../checked_pb.js";
import type { ErrorSet, ExprValue, UnknownSet } from "../../eval_pb.js";
import type { Value } from "../../value_pb.js";
import type { Message } from "@bufbuild/protobuf";
/**
* Describes the file cel/expr/conformance/test/simple.proto.
*/
export declare const file_cel_expr_conformance_test_simple: GenFile;
/**
* 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.
*
* Deprecated: Use cel.expr.conformance.test.Suite
*
* @generated from message cel.expr.conformance.test.SimpleTestFile
*/
export type SimpleTestFile = Message<"cel.expr.conformance.test.SimpleTestFile"> & {
/**
* Required. The name of the file. Should match the filename.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* A description of the file.
*
* @generated from field: string description = 2;
*/
description: string;
/**
* The contained sections.
*
* @generated from field: repeated cel.expr.conformance.test.SimpleTestSection section = 3;
*/
section: SimpleTestSection[];
};
/**
* Describes the message cel.expr.conformance.test.SimpleTestFile.
* Use `create(SimpleTestFileSchema)` to create a new message.
*/
export declare const SimpleTestFileSchema: GenMessage<SimpleTestFile>;
/**
* A collection of related SimpleTests.
*
* The section is the unit of organization within a test file, and should
* guide where new tests are added.
*
* @generated from message cel.expr.conformance.test.SimpleTestSection
*/
export type SimpleTestSection = Message<"cel.expr.conformance.test.SimpleTestSection"> & {
/**
* Required. The name of the section.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* A description of the section.
*
* @generated from field: string description = 2;
*/
description: string;
/**
* The contained tests.
*
* @generated from field: repeated cel.expr.conformance.test.SimpleTest test = 3;
*/
test: SimpleTest[];
};
/**
* Describes the message cel.expr.conformance.test.SimpleTestSection.
* Use `create(SimpleTestSectionSchema)` to create a new message.
*/
export declare const SimpleTestSectionSchema: GenMessage<SimpleTestSection>;
/**
* 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.
*
* @generated from message cel.expr.conformance.test.SimpleTest
*/
export type SimpleTest = Message<"cel.expr.conformance.test.SimpleTest"> & {
/**
* Required. The name of the test, which should be unique in the test file.
*
* @generated from field: string name = 1;
*/
name: string;
/**
* A description of the test.
*
* @generated from field: string description = 2;
*/
description: string;
/**
* Required. The text of the CEL expression.
*
* @generated from field: string expr = 3;
*/
expr: string;
/**
* Disables all macro expansion in parsing.
*
* @generated from field: bool disable_macros = 4;
*/
disableMacros: boolean;
/**
* Disables the check phase.
*
* @generated from field: bool disable_check = 5;
*/
disableCheck: boolean;
/**
* Disables the evaluate phase.
*
* @generated from field: bool check_only = 15;
*/
checkOnly: boolean;
/**
* The type environment to use for the check phase.
*
* @generated from field: repeated cel.expr.Decl type_env = 6;
*/
typeEnv: Decl[];
/**
* The container for name resolution.
*
* @generated from field: string container = 13;
*/
container: string;
/**
* The locale to use for the evaluation phase.
*
* @generated from field: string locale = 14;
*/
locale: string;
/**
* Variable bindings to use for the eval phase.
*
* @generated from field: map<string, cel.expr.ExprValue> bindings = 7;
*/
bindings: {
[key: string]: ExprValue;
};
/**
* An unspecified result defaults to a matcher for the true boolean value.
*
* @generated from oneof cel.expr.conformance.test.SimpleTest.result_matcher
*/
resultMatcher: {
/**
* 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 value = 8;
*/
value: Value;
case: "value";
} | {
/**
* A result and deduced expression type.
*
* @generated from field: cel.expr.conformance.test.TypedResult typed_result = 16;
*/
value: TypedResult;
case: "typedResult";
} | {
/**
* Matches error evaluation results.
*
* @generated from field: cel.expr.ErrorSet eval_error = 9;
*/
value: ErrorSet;
case: "evalError";
} | {
/**
* Matches one of several error results.
* (Using explicit message since oneof can't handle repeated.)
*
* @generated from field: cel.expr.conformance.test.ErrorSetMatcher any_eval_errors = 10;
*/
value: ErrorSetMatcher;
case: "anyEvalErrors";
} | {
/**
* Matches unknown evaluation results.
*
* @generated from field: cel.expr.UnknownSet unknown = 11;
*/
value: UnknownSet;
case: "unknown";
} | {
/**
* Matches one of several unknown results.
* (Using explicit message since oneof can't handle repeated.)
*
* @generated from field: cel.expr.conformance.test.UnknownSetMatcher any_unknowns = 12;
*/
value: UnknownSetMatcher;
case: "anyUnknowns";
} | {
case: undefined;
value?: undefined;
};
};
/**
* Describes the message cel.expr.conformance.test.SimpleTest.
* Use `create(SimpleTestSchema)` to create a new message.
*/
export declare const SimpleTestSchema: GenMessage<SimpleTest>;
/**
* Matches a result along with deduced expression type.
*
* @generated from message cel.expr.conformance.test.TypedResult
*/
export type TypedResult = Message<"cel.expr.conformance.test.TypedResult"> & {
/**
* A normal value, which must match the evaluation result exactly
* via value equality semantics. This is ignored if the test is `check_only`.
*
* @generated from field: cel.expr.Value result = 1;
*/
result?: Value;
/**
* The deduced type of the expression as reported by the checker.
*
* @generated from field: cel.expr.Type deduced_type = 2;
*/
deducedType?: Type;
};
/**
* Describes the message cel.expr.conformance.test.TypedResult.
* Use `create(TypedResultSchema)` to create a new message.
*/
export declare const TypedResultSchema: GenMessage<TypedResult>;
/**
* Matches error results from Eval.
*
* @generated from message cel.expr.conformance.test.ErrorSetMatcher
*/
export type ErrorSetMatcher = Message<"cel.expr.conformance.test.ErrorSetMatcher"> & {
/**
* Success if we match any of these sets.
*
* @generated from field: repeated cel.expr.ErrorSet errors = 1;
*/
errors: ErrorSet[];
};
/**
* Describes the message cel.expr.conformance.test.ErrorSetMatcher.
* Use `create(ErrorSetMatcherSchema)` to create a new message.
*/
export declare const ErrorSetMatcherSchema: GenMessage<ErrorSetMatcher>;
/**
* Matches unknown results from Eval.
*
* @generated from message cel.expr.conformance.test.UnknownSetMatcher
*/
export type UnknownSetMatcher = Message<"cel.expr.conformance.test.UnknownSetMatcher"> & {
/**
* Success if we match any of these sets.
*
* @generated from field: repeated cel.expr.UnknownSet unknowns = 1;
*/
unknowns: UnknownSet[];
};
/**
* Describes the message cel.expr.conformance.test.UnknownSetMatcher.
* Use `create(UnknownSetMatcherSchema)` to create a new message.
*/
export declare const UnknownSetMatcherSchema: GenMessage<UnknownSetMatcher>;