Skip to content
GitHub

ValidationIssue

interface in meocord/common Since 4.1.0

interface ValidationIssue

One problem @Validate found in a handler's input.

Members

message

message: string

What is wrong, as the schema library wrote it.

path

path: PropertyKey[]

Where it is, such as ['minutes']; empty for the input as a whole.

raw Since 4.3.0

readonly raw?: StandardSchemaV1Issue

The issue exactly as the schema's validate reported it, with the library's own fields, such as zod's code and minimum, for words of your own in the user's language. Only an issue from a schema has it, and it is non-enumerable, so toEqual({ message, path }) and a serialised issue leave it out.

TypeScript
declare const issue: ValidationIssue

const raw = issue.raw as { code?: string; minimum?: number } | undefined
const tooSmall = raw?.code === 'too_small' ? raw.minimum : undefined

See also