vapor-chamber API reference - v1.16.0
    Preparing search index...

    Type Alias SchemaValidatorOptions

    type SchemaValidatorOptions = {
        field?: "target" | "payload" | "both" | ((cmd: Command) => unknown);
        onInvalid?: "reject" | "warn";
    }
    Index
    field?: "target" | "payload" | "both" | ((cmd: Command) => unknown)

    Which field on the Command to validate. Default: 'target'.

    • 'target' — validate cmd.target
    • 'payload' — validate cmd.payload
    • 'both' — validate { target, payload } as a single object
    • (cmd) => unknown — extract a custom value from cmd
    onInvalid?: "reject" | "warn"

    What to do on validation failure:

    • 'reject' (default) — return { ok: false, error: BusError(VC_VALIDATION_FAILED) } without invoking the handler
    • 'warn'console.warn and continue to the handler with the original (un-coerced) command

    Even in 'warn' mode, the schema's .parse() coercions are NOT applied — the original command flows through unchanged. To use coerced values, use 'reject' mode and validate before dispatching.