@accelerated-software-development/caddy-api-client - v0.4.3
    Preparing search index...

    Function validate

    • Validate and parse data with a schema

      Type Parameters

      • T

      Parameters

      • schema: ZodType<T>

        Zod schema

      • data: unknown

        Data to validate

      Returns T

      Parsed and validated data

      If validation fails

      import { validate, DomainSchema } from "@accelerated-software-development/caddy-api-client";

      try {
      const domain = validate(DomainSchema, userInput);
      } catch (error) {
      if (error instanceof ValidationError) {
      console.error("Invalid input:", error.errors);
      }
      }