CMS Entry API Schemas (cms/schemas.ts)

webiny-js · packages/sdk/src/methods/cms/schemas.ts · typescript · MIT
database, integration, fw:zod, tag:validation, tag:cms

Zod validation schemas for CMS entry operations like listing, getting, creating, updating, publishing and deleting content entries via the SDK.

// Source: https://github.com/webiny/webiny-js | License: MIT | Copyright Webiny Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from "zod";

const modelId = z.string().min(1, "modelId is required");
const revisionId = z.string().min(1, "revisionId is required");
const fields = z.array(z.string().min(1)).min(1, "fields must contain at least one entry");
const where = z.record(z.string(), z.unknown()).optional();
const preview = z.boolean().optional();

export const listEntriesSchema = z.object({
    modelId,
    where,
    sort: z.record(z.string(), z.union([z.literal("asc"), z.literal("desc")])).optional(),
    limit: z.number().int().positive().optional(),
    after: z.string().optional(),
    search: z.string().optional(),
    fields,
    preview
});

e

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key