Skip to content

Function: autoValidator()

ts
function autoValidator<T>(schema): FusionValidator<T>;

Defined in: packages/core/src/core/StandardSchema.ts:233

Auto-detect and create a FusionValidator from any supported schema.

Detection order:

  1. Standard Schema v1 (Valibot, ArkType, etc.)
  2. Zod-like (has .safeParse())
  3. Throws if unrecognized

Type Parameters

Type ParameterDefault type
Tunknown

Parameters

ParameterTypeDescription
schemaunknownAny supported schema

Returns

FusionValidator<T>

A FusionValidator

Throws

If the schema type is not recognized