Validate and parse data with a schema
Zod schema
Data to validate
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); }} Copy
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); }}
Validate and parse data with a schema