Standard Schema
Bring any Standard Schema validator — Zod, Valibot, ArkType — for validation and inferred types.
Validate an API response with Zod — or Valibot, ArkType, or any Standard Schema validator. StitchAPI is validator-agnostic: bring the schema you already have, hand it straight to a stitch, and each response is checked against it — with the result type inferred from the same schema.
Example
import { } from 'stitchapi';
import { } from 'zod';
const = .({ : .(), : .() });
const = <{ : number; : string }>({
: 'https://api.example.com',
: '/users/{id}',
: ,
});The output schema runs against each response; pairing it with the
stitch<{ id: number; name: string }> generic types the validated result.
Options
A config's input and output fields accept a raw schema directly — Zod (via
safeParse), any Standard Schema (~standard), or a plain predicate
((value) => boolean). Valibot and ArkType implement Standard Schema, so they
pass the same way with no special handling.
For anything the built-in coercions don't cover, expose the
Standard Schema ~standard interface on your own
object — a stitch checks it exactly like a Zod schema, no wrapper in between.
Pair the schema with the stitch<T>() generic so the typed result and the
runtime check come from one source.