@bufbuild/protovalidate
Version:
Protocol Buffer Validation for ECMAScript
25 lines (24 loc) • 888 B
TypeScript
import type { DescExtension, DescField, DescMessage, DescOneof } from "@bufbuild/protobuf";
import { type Path } from "@bufbuild/protobuf/reflect";
/**
* Cursor maintains a field path and tracks violations.
*/
export declare class Cursor {
private readonly root;
private readonly failFast;
private readonly violations;
private readonly builder;
static create(root: DescMessage, failFast: boolean): Cursor;
private constructor();
get violated(): boolean;
violate(message: string, ruleId: string, rulePath: Path, forMapKey?: boolean): void;
throwIfViolated(): void;
getPath(): Path;
add(path: Path): Cursor;
field(field: DescField): Cursor;
oneof(oneof: DescOneof): Cursor;
extension(ext: DescExtension): Cursor;
list(index: number): Cursor;
mapKey(key: string | number | bigint | boolean): Cursor;
private cloneWith;
}