Setu-TS
    Preparing search index...

    Class ValidationService

    Default validation service.

    The error formatter is resolved once at plugin construction time and passed in here, avoiding per-request formatter resolution.

    0.1.0

    Implements

    Index
    • Validate data against the given schema.

      The schema is expected to expose a safeParse method (Zod-compatible). On success the parsed value is returned wrapped in ok(); on failure the validator issues are mapped to ValidationIssue elements and returned via err().

      Type Parameters

      • T

        The validated output type

      Parameters

      • schema: unknown

        The schema object (must have safeParse)

      • data: unknown

        The value to validate

      Returns Result<T, readonly ValidationIssue[]>

      Ok with the parsed value or Err with the issues

      When the schema does not expose a safeParse method