fail

View Source

Summary

Creates a Standard Schema failure result with a single issue.

Signature

function fail(
  message: string,
  path: readonly (PropertyKey | PathSegment)[] | undefined,
  options: {
    code?: string;
    input?: unknown;
    parseOptions?: ParseOptions;
    values?: Record<string, unknown>;
  },
): FailureResult;

Params

message

Human-readable validation message.

path

Optional issue path within the input value.

options

Optional issue metadata used for localized error mapping.

Returns

A failure result containing one issue.