GitHub API Response to Zod

Paste any GitHub REST API JSON response and get a Zod schema instantly. Works for repos, issues, pull requests, releases, workflow runs — any /api.github.com/* endpoint, validated at the boundary of your code.

JSON input valid
Zod output

      
    

About this conversion

GitHub's REST API quietly evolves: fields appear as previews, get GA'd, and occasionally vanish in API version bumps. If your script reads a GitHub response with TypeScript types alone, a missing field crashes only when you reach for it. Wrapping the call in a Zod schema's parse turns that into a single, named error at the boundary — you know exactly which field GitHub didn't send and you can decide to fail closed or fall back. The schema generated here matches the exact JSON shape you paste, so unused fields stay out of the surface area.

The output is a copy-paste-runnable z.object you can import alongside @octokit/rest, the GitHub SDK in any language, or a raw fetch. Use it on rate-limited endpoints (it's cheaper than re-typing every response by hand), in GitHub Actions where dependency size matters, or in webhook receivers where the body is untrusted JSON. Each merged response array becomes a single schema; missing fields across samples become .optional(); nullable fields become z.union with z.null().

Same shape, other validators

Other JSON shapes