← nopea.tech
ScaneaConsenteaMaskeaBundlesPricing
Validation & structured output

Retries and validation together

Put validation() closest to the call (last .use()) so a transient network error retries via retries() first, and a schema failure retries separately via validation()'s own maxRetries.

← All recipes
import { Maskea, retries, validation } from "@nopeatech/maskea";
import { z } from "zod";

const maskea = new Maskea()
  .use(retries({ max: 3 }))          // handles 429/5xx
  .use(validation({ schema: z.object({ ok: z.boolean() }) })); // handles bad JSON

Checked against the shipped @nopeatech/maskea API. Full docs at nopea.tech/maskea/docs.

More in Validation & structured output

Force structured JSON output with Zod →Validate without Zod →