LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download

    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • swap_horiz
      Codec
    • schema
      Standard Schema
    • format_quote
      String

    • error
      Stack

    • article
      Blog
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
Expand sidebarExpand sidebar
zod/v3 (index)/SourceSource
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
github
GitHubGitHub
DiscordDiscord
schemas/libraries/zod/v3/download/index.ts
Copy to clipboardCopy to clipboard
import * as z from "zod/v3"; import type { ProductData } from "#src"; const imageSchema = z.object({ id: z.number(), created: z.date(), title: z.string().min(1).max(100), type: z.enum(["jpg", "png"]), size: z.number(), url: z.string().url(), }); const ratingSchema = z.object({ id: z.number(), stars: z.number().min(0).max(5), title: z.string().min(1).max(100), text: z.string().min(1).max(1000), images: z.array(imageSchema), }); const productSchema = z.object({ id: z.number(), created: z.date(), title: z.string().min(1).max(100), brand: z.string().min(1).max(30), description: z.string().min(1).max(500), price: z.number().min(1).max(10000), discount: z.number().min(1).max(100).nullable(), quantity: z.number().min(0).max(10), tags: z.array(z.string().min(1).max(30)), images: z.array(imageSchema), ratings: z.array(ratingSchema), }) satisfies z.ZodType<ProductData>; productSchema.parse({});
Created by eskimojo for Open Circle