LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download
    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • 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
Benchmarks/StackStack
Code styleCode style
Normal styleNormal style
System themeSystem theme
Light themeLight theme
Dark themeDark theme
github
GitHubGitHub
DiscordDiscord

Comparison of the errors thrown by libraries, including stack trace length.

import { personSchema } from "./schemas";
import * as v from "valibot";

try {
  v.parse(personSchema, data);
} catch (e) {
  console.error(e);
}

Where error.stack is available, we measure how many frames it takes to reach the line of user code (as opposed to library code).

ValiError: Invalid length: Expected >=1 but received 0
    at Module.parse (file:///node_modules/.pnpm/valibot@1.2.0_typescript@6.0.0-beta/node_modules/valibot/dist/index.mjs:6748:28)
    at Object.throw (file:///schemas/dist/benchmarks-D-_Y96Ph.js:93:6)
    at file:///bench/src/scripts/stack/log.ts:24:28
LibrarysortVersionDownloads (/wk)sortFrame #arrow_upwardLine countsort
typebox
Code snippetCode snippet
Value.Parse(schema, data)
Error outputError output
ParseError: Parse
    at Module.Parse (file:///node_modules/.pnpm/typebox@1.1.5/node_modules/typebox/build/value/parse/parse.mjs:46:11)
    at Object.throw (file:///schemas/dist/benchmarks-CuxSwlWr.js:219:6)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  [cause]: {
    source: 'Parse',
    errors: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object]
    ],
    value: {
      id: 252,
      created: 2026-03-02T16:30:33.589Z,
      title: '',
      brand: 'Sunny Backyard',
      description: 'Red apple from Lake Constance',
      price: 0,
      discount: null,
      quantity: 1000,
      tags: [Array],
      images: [Array],
      ratings: [Array]
    }
  }
}
1.1.5204K2
28
valibot
Code snippetCode snippet
v.parse(schema, data)
Error outputError output
ValiError: Invalid length: Expected >=1 but received 0
    at Module.parse (file:///node_modules/.pnpm/valibot@1.2.0_typescript@6.0.0-dev.20260302/node_modules/valibot/dist/index.mjs:6748:28)
    at Object.throw (file:///schemas/dist/benchmarks-CQZYHRf4.js:93:6)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  issues: [
    {
      kind: 'validation',
      type: 'min_length',
      input: '',
      expected: '>=1',
      received: '0',
      message: 'Invalid length: Expected >=1 but received 0',
      requirement: 1,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'validation',
      type: 'min_value',
      input: 0,
      expected: '>=1',
      received: '0',
      message: 'Invalid value: Expected >=1 but received 0',
      requirement: 1,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'validation',
      type: 'max_value',
      input: 1000,
      expected: '<=10',
      received: '1000',
      message: 'Invalid value: Expected <=10 but received 1000',
      requirement: 10,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'string',
      input: null,
      expected: 'string',
      received: 'null',
      message: 'Invalid type: Expected string but received null',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'string',
      input: undefined,
      expected: 'string',
      received: 'undefined',
      message: 'Invalid type: Expected string but received undefined',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'object',
      input: undefined,
      expected: '"id"',
      received: 'undefined',
      message: 'Invalid key: Expected "id" but received undefined',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'date',
      input: null,
      expected: 'Date',
      received: 'null',
      message: 'Invalid type: Expected Date but received null',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'picklist',
      input: 'mp4',
      expected: '("jpg" | "png")',
      received: '"mp4"',
      message: 'Invalid type: Expected ("jpg" | "png") but received "mp4"',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'object',
      input: undefined,
      expected: '"url"',
      received: 'undefined',
      message: 'Invalid key: Expected "url" but received undefined',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'number',
      input: '352',
      expected: 'number',
      received: '"352"',
      message: 'Invalid type: Expected number but received "352"',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'date',
      input: undefined,
      expected: 'Date',
      received: 'undefined',
      message: 'Invalid type: Expected Date but received undefined',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'validation',
      type: 'url',
      input: 'INVALID_URL',
      expected: null,
      received: '"INVALID_URL"',
      message: 'Invalid URL: Received "INVALID_URL"',
      requirement: [Function: requirement],
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'object',
      input: undefined,
      expected: '"title"',
      received: 'undefined',
      message: 'Invalid key: Expected "title" but received undefined',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'object',
      input: undefined,
      expected: '"type"',
      received: 'undefined',
      message: 'Invalid key: Expected "type" but received undefined',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    },
    {
      kind: 'schema',
      type: 'object',
      input: undefined,
      expected: '"size"',
      received: 'undefined',
      message: 'Invalid key: Expected "size" but received undefined',
      requirement: undefined,
      path: [Array],
      issues: undefined,
      lang: undefined,
      abortEarly: undefined,
      abortPipeEarly: undefined
    }
  ]
}
1.2.06.6M2
218
effect
Code snippetCode snippet
// const decodeAll = Schema.decodeUnknownEither(
//  schema, 
//  { errors: "all" }
// );
Effect.runSync(decodeAll(data));

(Commented code is not benchmarked)

Error outputError output
(FiberFailure) ParseError: { readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly brand: minLength(1) & maxLength(30); readonly description: minLength(1) & maxLength(500); readonly price: greaterThanOrEqualTo(1) & lessThanOrEqualTo(10000); readonly discount: greaterThanOrEqualTo(1) & lessThanOrEqualTo(100) | null; readonly quantity: greaterThanOrEqualTo(1) & lessThanOrEqualTo(10); readonly tags: ReadonlyArray<minLength(1) & maxLength(30)>; readonly images: ReadonlyArray<{ readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }>; readonly ratings: ReadonlyArray<{ readonly id: number; readonly stars: greaterThanOrEqualTo(0) & lessThanOrEqualTo(5); readonly title: minLength(1) & maxLength(100); readonly text: minLength(1) & maxLength(1000); readonly images: ReadonlyArray<{ readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }> }> }
├─ ["title"]
│  └─ minLength(1) & maxLength(100)
│     └─ From side refinement failure
│        └─ minLength(1)
│           └─ Predicate refinement failure
│              └─ Expected a string at least 1 character(s) long, actual ""
├─ ["price"]
│  └─ greaterThanOrEqualTo(1) & lessThanOrEqualTo(10000)
│     └─ From side refinement failure
│        └─ greaterThanOrEqualTo(1)
│           └─ Predicate refinement failure
│              └─ Expected a number greater than or equal to 1, actual 0
├─ ["quantity"]
│  └─ greaterThanOrEqualTo(1) & lessThanOrEqualTo(10)
│     └─ Predicate refinement failure
│        └─ Expected a number less than or equal to 10, actual 1000
├─ ["tags"]
│  └─ ReadonlyArray
│     ├─ [1]
│     │  └─ minLength(1) & maxLength(30)
│     │     └─ From side refinement failure
│     │        └─ minLength(1)
│     │           └─ From side refinement failure
│     │              └─ Expected string, actual null
│     └─ [3]
│        └─ minLength(1) & maxLength(30)
│           └─ From side refinement failure
│              └─ minLength(1)
│                 └─ From side refinement failure
│                    └─ Expected string, actual undefined
├─ ["images"]
│  └─ ReadonlyArray<{ readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }>
│     ├─ [0]
│     │  └─ { readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }
│     │     ├─ ["id"]
│     │     │  └─ is missing
│     │     ├─ ["created"]
│     │     │  └─ Expected Date, actual null
│     │     └─ ["type"]
│     │        └─ "jpg" | "png"
│     │           ├─ Expected "jpg", actual "mp4"
│     │           └─ Expected "png", actual "mp4"
│     └─ [1]
│        └─ { readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }
│           └─ ["url"]
│              └─ is missing
└─ ["ratings"]
   └─ ReadonlyArray<{ readonly id: number; readonly stars: greaterThanOrEqualTo(0) & lessThanOrEqualTo(5); readonly title: minLength(1) & maxLength(100); readonly text: minLength(1) & maxLength(1000); readonly images: ReadonlyArray<{ readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }> }>
      └─ [1]
         └─ { readonly id: number; readonly stars: greaterThanOrEqualTo(0) & lessThanOrEqualTo(5); readonly title: minLength(1) & maxLength(100); readonly text: minLength(1) & maxLength(1000); readonly images: ReadonlyArray<{ readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }> }
            └─ ["images"]
               └─ ReadonlyArray<{ readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }>
                  ├─ [0]
                  │  └─ { readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }
                  │     ├─ ["id"]
                  │     │  └─ Expected number, actual "352"
                  │     ├─ ["created"]
                  │     │  └─ Expected Date, actual undefined
                  │     └─ ["url"]
                  │        └─ { string | filter }
                  │           └─ Predicate refinement failure
                  │              └─ Expected { string | filter }, actual "INVALID_URL"
                  └─ [1]
                     └─ { readonly id: number; readonly created: Date; readonly title: minLength(1) & maxLength(100); readonly type: "jpg" | "png"; readonly size: number; readonly url: { string | filter } }
                        ├─ ["title"]
                        │  └─ is missing
                        ├─ ["type"]
                        │  └─ is missing
                        └─ ["size"]
                           └─ is missing
    at parseError (file:///node_modules/.pnpm/effect@3.19.19/node_modules/effect/dist/esm/ParseResult.js:241:36)
    at file:///node_modules/.pnpm/effect@3.19.19/node_modules/effect/dist/esm/Either.js:197:78
    at Module. (file:///node_modules/.pnpm/effect@3.19.19/node_modules/effect/dist/esm/Function.js:98:18)
    at file:///node_modules/.pnpm/effect@3.19.19/node_modules/effect/dist/esm/Schema.js:353:42
    at Object.throw (file:///schemas/dist/benchmarks-CvtHWE-F.js:127:14)
    at file:///bench/src/scripts/stack/log.ts:24:28
3.19.198.3M5
78
sury
Code snippetCode snippet
S.parseOrThrow(data, schema)
Error outputError output
SuryError: Failed parsing at ["title"]: String must be 1 or more characters long
    at $$throw (/node_modules/.pnpm/sury@11.0.0-alpha.4/node_modules/sury/src/Sury.res.js:776:9)
    at Array.<anonymous> (/node_modules/.pnpm/sury@11.0.0-alpha.4/node_modules/sury/src/Sury.res.js:792:25)
    at eval (eval at internalCompile (/node_modules/.pnpm/sury@11.0.0-alpha.4/node_modules/sury/src/Sury.res.js:1418:10), <anonymous>:3:414)
    at Module.parseOrThrow (/node_modules/.pnpm/sury@11.0.0-alpha.4/node_modules/sury/src/Sury.res.js:1524:32)
    at Object.throw (file:///schemas/dist/benchmarks-C052wDpV.js:123:6)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  flag: 1,
  code: {
    TAG: 'OperationFailed',
    _0: 'String must be 1 or more characters long'
  },
  path: '["title"]'
}
11.0.0-alpha.4148K5
15
typia
Code snippetCode snippet
// const assert = typia.createAssert<TypiaSchema>();
assert(data);

(Commented code is not benchmarked)

Error outputError output
TypeGuardError: Error on typia.createAssert(): invalid type on $input.title, expect to be string & MinLength<1>
    at Module._assertGuard (/node_modules/.pnpm/typia@11.0.3_@types+node@24.11.0_typescript@6.0.0-dev.20260302/node_modules/typia/lib/internal/_assertGuard.js:10:19)
    at i (file:///schemas/dist/benchmarks-2zi5NqJe.js:316:71)
    at file:///schemas/dist/benchmarks-2zi5NqJe.js:592:14
    at assert (file:///schemas/dist/benchmarks-2zi5NqJe.js:597:10)
    at Object.throw (file:///schemas/dist/benchmarks-2zi5NqJe.js:1272:4)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  method: 'typia.createAssert',
  path: '$input.title',
  expected: 'string & MinLength<1>',
  value: ''
}
11.0.3244K5
13
effect___beta
Code snippetCode snippet
Schema.decodeUnknownSync(schema)(data, { errors: "first" })
Error outputError output
Error: Expected a value with a length of at least 1, got ""
  at ["title"]
    at file:///node_modules/.pnpm/effect@4.0.0-beta.5/node_modules/effect/dist/SchemaParser.js:250:99
    at file:///node_modules/.pnpm/effect@4.0.0-beta.5/node_modules/effect/dist/internal/effect.js:1068:19
    at file:///node_modules/.pnpm/effect@4.0.0-beta.5/node_modules/effect/dist/Function.js:94:18
    at file:///node_modules/.pnpm/effect@4.0.0-beta.5/node_modules/effect/dist/internal/effect.js:1019:85
    at Module.<anonymous> (file:///node_modules/.pnpm/effect@4.0.0-beta.5/node_modules/effect/dist/Function.js:94:18)
    at file:///node_modules/.pnpm/effect@4.0.0-beta.5/node_modules/effect/dist/SchemaParser.js:250:52
    at Object.throw (file:///schemas/dist/benchmarks-D0Goq9pB.js:120:26)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  [cause]: Composite {
    '~effect/SchemaIssue/Issue': '~effect/SchemaIssue/Issue',
    _tag: 'Composite',
    ast: Objects {
      '~effect/Schema': '~effect/Schema',
      annotations: undefined,
      checks: undefined,
      encoding: undefined,
      context: undefined,
      _tag: 'Objects',
      propertySignatures: [Array],
      indexSignatures: []
    },
    actual: { _id: 'Option', _tag: 'Some', value: [Object] },
    issues: [ [Pointer] ]
  }
}
4.0.0-beta.58.3M7
28
arktype
Code snippetCode snippet
schema.assert(data)
Error outputError output
TraversalError: 
  • images[0].created must be a Date (was null)
  • images[0].id must be a number (was missing)
  • images[0].type must be "jpg" or "png" (was "mp4")
  • images[1].url must be a string (was missing)
  • price must be at least 1 (was 0)
  • quantity must be at most 10 (was 1000)
  • ratings[1].images[0].created must be a Date (was undefined)
  • ratings[1].images[0].id must be a number (was a string)
  • ratings[1].images[0].url must be a URL string (was "INVALID_URL")
  • ratings[1].images[1].size must be a number (was missing)
  • ratings[1].images[1].title must be a string (was missing)
  • ratings[1].images[1].type must be "jpg" or "png" (was missing)
  • tags[1] must be a string (was null)
  • tags[3] must be a string (was undefined)
  • title must be non-empty
    at ArkErrors.toTraversalError (file:///node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/errors.js:146:16)
    at ArkErrors.throw (file:///node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/errors.js:139:20)
    at file:///node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/node.js:166:85
    at Traversal.finalize (file:///node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/traversal.js:112:29)
    at IntersectionNode.rootApply (file:///node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/node.js:118:32)
    at BaseNode.attach (file:///node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/node.js:33:25)
    at IntersectionNode.assert (file:///node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/node.js:166:42)
    at Object.throw (file:///schemas/dist/benchmarks-DOEH0FpJ.js:76:6)
    at file:///bench/src/scripts/stack/log.ts:24:28
2.1.29972K8
26
ajv
Code snippetCode snippet
// const validate = ajv.compile(schema);
validate(data);
throw new ValidationError(validate.errors || []);

(Commented code is not benchmarked)

Error outputError output
ValidationError: validation failed
    at Object.throw (file:///schemas/dist/benchmarks-BqONtd8d.js:201:16)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  errors: [
    {
      instancePath: '/title',
      schemaPath: '#/properties/title/minLength',
      keyword: 'minLength',
      params: [Object],
      message: 'must NOT have fewer than 1 characters'
    }
  ],
  validation: true,
  ajv: true
}
8.18.0258M16
joi
Code snippetCode snippet
throw schema.validate(data).error
Error outputError output
[Error [ValidationError]: "title" is not allowed to be empty] {
  _original: {
    id: 252,
    created: 2026-03-02T16:30:33.139Z,
    title: '',
    brand: 'Sunny Backyard',
    description: 'Red apple from Lake Constance',
    price: 0,
    discount: null,
    quantity: 1000,
    tags: [ 'fruit', null, 'round', undefined, 'juicy', 'healthy' ],
    images: [ [Object], [Object], [Object] ],
    ratings: [ [Object], [Object] ]
  },
  details: [
    {
      message: '"title" is not allowed to be empty',
      path: [Array],
      type: 'string.empty',
      context: [Object]
    }
  ]
}
18.0.218M24
yup
Code snippetCode snippet
schema.validateSync(data)
Error outputError output
ValidationError: ratings[1].images[0].url must be a valid URL
    at createError (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:352:21)
    at handleResult (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:371:104)
    at validate (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:394:5)
    at StringSchema.runTests (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:855:7)
    at /node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:810:12
    at nextOnce (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:841:7)
    at finishTestRun (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:860:11)
    at handleResult (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:371:124)
    at validate (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:394:5)
    at StringSchema.runTests (/node_modules/.pnpm/yup@1.7.1/node_modules/yup/index.js:855:7) {
  value: {
    ratings: [ [Object], [Object] ],
    images: [ [Object], [Object], [Object] ],
    tags: [ 'fruit', null, 'round', undefined, 'juicy', 'healthy' ],
    quantity: 1000,
    discount: null,
    price: 0,
    description: 'Red apple from Lake Constance',
    brand: 'Sunny Backyard',
    title: '',
    created: 2026-03-02T16:30:34.137Z,
    id: 252
  },
  path: 'ratings[1].images[0].url',
  type: 'url',
  params: {
    value: 'INVALID_URL',
    originalValue: 'INVALID_URL',
    label: undefined,
    path: 'ratings[1].images[0].url',
    spec: {
      strip: false,
      strict: false,
      abortEarly: true,
      recursive: true,
      disableStackTrace: false,
      nullable: false,
      optional: false,
      coerce: true
    },
    disableStackTrace: false,
    regex: /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
  },
  errors: [ 'ratings[1].images[0].url must be a valid URL' ],
  inner: [],
  Symbol(Symbol.toStringTag): 'Error'
}
1.7.110M49
zod
Code snippetCode snippet
schema.parse(data)
Error outputError output
ZodError: [
  {
    "origin": "string",
    "code": "too_small",
    "minimum": 1,
    "inclusive": true,
    "path": [
      "title"
    ],
    "message": "Too small: expected string to have >=1 characters"
  },
  {
    "origin": "number",
    "code": "too_small",
    "minimum": 1,
    "inclusive": true,
    "path": [
      "price"
    ],
    "message": "Too small: expected number to be >=1"
  },
  {
    "origin": "number",
    "code": "too_big",
    "maximum": 10,
    "inclusive": true,
    "path": [
      "quantity"
    ],
    "message": "Too big: expected number to be <=10"
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": [
      "tags",
      1
    ],
    "message": "Invalid input: expected string, received null"
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": [
      "tags",
      3
    ],
    "message": "Invalid input: expected string, received undefined"
  },
  {
    "expected": "number",
    "code": "invalid_type",
    "path": [
      "images",
      0,
      "id"
    ],
    "message": "Invalid input: expected number, received undefined"
  },
  {
    "expected": "date",
    "code": "invalid_type",
    "path": [
      "images",
      0,
      "created"
    ],
    "message": "Invalid input: expected date, received null"
  },
  {
    "code": "invalid_value",
    "values": [
      "jpg",
      "png"
    ],
    "path": [
      "images",
      0,
      "type"
    ],
    "message": "Invalid option: expected one of \"jpg\"|\"png\""
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": [
      "images",
      1,
      "url"
    ],
    "message": "Invalid input: expected string, received undefined"
  },
  {
    "expected": "number",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "id"
    ],
    "message": "Invalid input: expected number, received string"
  },
  {
    "expected": "date",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "created"
    ],
    "message": "Invalid input: expected date, received undefined"
  },
  {
    "code": "invalid_format",
    "format": "url",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "url"
    ],
    "message": "Invalid URL"
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      1,
      "title"
    ],
    "message": "Invalid input: expected string, received undefined"
  },
  {
    "code": "invalid_value",
    "values": [
      "jpg",
      "png"
    ],
    "path": [
      "ratings",
      1,
      "images",
      1,
      "type"
    ],
    "message": "Invalid option: expected one of \"jpg\"|\"png\""
  },
  {
    "expected": "number",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      1,
      "size"
    ],
    "message": "Invalid input: expected number, received undefined"
  }
]
    at Object.throw (file:///schemas/dist/benchmarks-DnwtXqL6.js:81:6)
    at file:///bench/src/scripts/stack/log.ts:24:28
4.3.6106M171
zod/mini
Code snippetCode snippet
schema.parse(data)
Error outputError output
$ZodError: [
  {
    "origin": "string",
    "code": "too_small",
    "minimum": 1,
    "inclusive": true,
    "path": [
      "title"
    ],
    "message": "Invalid input"
  },
  {
    "origin": "number",
    "code": "too_small",
    "minimum": 1,
    "inclusive": true,
    "path": [
      "price"
    ],
    "message": "Invalid input"
  },
  {
    "origin": "number",
    "code": "too_big",
    "maximum": 10,
    "inclusive": true,
    "path": [
      "quantity"
    ],
    "message": "Invalid input"
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": [
      "tags",
      1
    ],
    "message": "Invalid input"
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": [
      "tags",
      3
    ],
    "message": "Invalid input"
  },
  {
    "expected": "number",
    "code": "invalid_type",
    "path": [
      "images",
      0,
      "id"
    ],
    "message": "Invalid input"
  },
  {
    "expected": "date",
    "code": "invalid_type",
    "path": [
      "images",
      0,
      "created"
    ],
    "message": "Invalid input"
  },
  {
    "code": "invalid_value",
    "values": [
      "jpg",
      "png"
    ],
    "path": [
      "images",
      0,
      "type"
    ],
    "message": "Invalid input"
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": [
      "images",
      1,
      "url"
    ],
    "message": "Invalid input"
  },
  {
    "expected": "number",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "id"
    ],
    "message": "Invalid input"
  },
  {
    "expected": "date",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "created"
    ],
    "message": "Invalid input"
  },
  {
    "code": "invalid_format",
    "format": "url",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "url"
    ],
    "message": "Invalid input"
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      1,
      "title"
    ],
    "message": "Invalid input"
  },
  {
    "code": "invalid_value",
    "values": [
      "jpg",
      "png"
    ],
    "path": [
      "ratings",
      1,
      "images",
      1,
      "type"
    ],
    "message": "Invalid input"
  },
  {
    "expected": "number",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      1,
      "size"
    ],
    "message": "Invalid input"
  }
]
    at Object.throw (file:///schemas/dist/benchmarks-D8x1MRf9.js:81:6)
    at file:///bench/src/scripts/stack/log.ts:24:28
4.3.6106M171
Created by eskimojo for Open Circle