Skip to content
Zap Studio
permit
Esc
navigateopen⌘Jpreview
On this page

Standard Schema Support

permit resources work with any Standard Schema-compatible validation library — Zod, Valibot, ArkType, or your own.

permit works with Zod, Valibot, ArkType, or any compatible library.

permit validates resources through the Standard Schema specification instead of binding to one validation library. Define resources with the Resources type helper and any Standard Schema-compatible schema.

Defining Resources

import { z } from "zod";
import type { Resources } from "@zap-studio/permit";

const resources = {
  post: z.object({
    id: z.string(),
    authorId: z.string(),
    visibility: z.enum(["public", "private"]),
  }),
} satisfies Resources;
import * as v from "valibot";
import type { Resources } from "@zap-studio/permit";

const resources = {
  post: v.object({
    id: v.string(),
    authorId: v.string(),
    visibility: v.picklist(["public", "private"]),
  }),
} satisfies Resources;
import { type } from "arktype";
import type { Resources } from "@zap-studio/permit";

const resources = {
  post: type({
    id: "string",
    authorId: "string",
    visibility: "'public' | 'private'",
  }),
} satisfies Resources;

How Validation Runs

Resources are validated against their schema whenever policy.can() evaluates a rule for that resource. Invalid resources resolve to false instead of throwing — see Error Handling for how permit surfaces failures.

Last updated on September 13, 2026

Was this page helpful?