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
    • assignment_turned_in
      TypeScript

  • JSON Schema

    • data_object
      Schema to JSON
    • code
      JSON to Schema
    • verified
      Compliance

    • deployed_code
      Libraries

    • article
      Blog
Expand sidebarExpand sidebar
Benchmarks/StackStack
github
GitHubGitHub
DiscordDiscord
PreferencesPreferences
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser
Code ligatures

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

Copy to clipboardCopy to clipboard
import * as v from "valibot"; import { personSchema } from "./schemas"; 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
Libraryarrow_upwardVersiondownload/wksortFrame #sortLine countsort
zod/v3
Code snippetCode snippet
schema.parse(data)
Error outputError output
ZodError: [
  {
    "code": "too_small",
    "minimum": 1,
    "type": "string",
    "inclusive": true,
    "exact": false,
    "message": "String must contain at least 1 character(s)",
    "path": [
      "title"
    ]
  },
  {
    "code": "too_small",
    "minimum": 1,
    "type": "number",
    "inclusive": true,
    "exact": false,
    "message": "Number must be greater than or equal to 1",
    "path": [
      "price"
    ]
  },
  {
    "code": "too_big",
    "maximum": 10,
    "type": "number",
    "inclusive": true,
    "exact": false,
    "message": "Number must be less than or equal to 10",
    "path": [
      "quantity"
    ]
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "null",
    "path": [
      "tags",
      1
    ],
    "message": "Expected string, received null"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "tags",
      3
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "undefined",
    "path": [
      "images",
      0,
      "id"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "date",
    "received": "null",
    "path": [
      "images",
      0,
      "created"
    ],
    "message": "Expected date, received null"
  },
  {
    "received": "mp4",
    "code": "invalid_enum_value",
    "options": [
      "jpg",
      "png"
    ],
    "path": [
      "images",
      0,
      "type"
    ],
    "message": "Invalid enum value. Expected 'jpg' | 'png', received 'mp4'"
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "images",
      1,
      "url"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "string",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "id"
    ],
    "message": "Expected number, received string"
  },
  {
    "code": "invalid_type",
    "expected": "date",
    "received": "undefined",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "created"
    ],
    "message": "Required"
  },
  {
    "validation": "url",
    "code": "invalid_string",
    "message": "Invalid url",
    "path": [
      "ratings",
      1,
      "images",
      0,
      "url"
    ]
  },
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": [
      "ratings",
      1,
      "images",
      1,
      "title"
    ],
    "message": "Required"
  },
  {
    "expected": "'jpg' | 'png'",
    "received": "undefined",
    "code": "invalid_type",
    "path": [
      "ratings",
      1,
      "images",
      1,
      "type"
    ],
    "message": "Required"
  },
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "undefined",
    "path": [
      "ratings",
      1,
      "images",
      1,
      "size"
    ],
    "message": "Required"
  }
]
    at get error (file:///node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js:39:31)
    at ZodObject.parse (file:///node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js:114:22)
    at Object.throw (file:///schemas/dist/benchmarks-Bqcn7-Ls.mjs:105:11)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  issues: [
    {
      code: 'too_small',
      minimum: 1,
      type: 'string',
      inclusive: true,
      exact: false,
      message: 'String must contain at least 1 character(s)',
      path: [Array]
    },
    {
      code: 'too_small',
      minimum: 1,
      type: 'number',
      inclusive: true,
      exact: false,
      message: 'Number must be greater than or equal to 1',
      path: [Array]
    },
    {
      code: 'too_big',
      maximum: 10,
      type: 'number',
      inclusive: true,
      exact: false,
      message: 'Number must be less than or equal to 10',
      path: [Array]
    },
    {
      code: 'invalid_type',
      expected: 'string',
      received: 'null',
      path: [Array],
      message: 'Expected string, received null'
    },
    {
      code: 'invalid_type',
      expected: 'string',
      received: 'undefined',
      path: [Array],
      message: 'Required'
    },
    {
      code: 'invalid_type',
      expected: 'number',
      received: 'undefined',
      path: [Array],
      message: 'Required'
    },
    {
      code: 'invalid_type',
      expected: 'date',
      received: 'null',
      path: [Array],
      message: 'Expected date, received null'
    },
    {
      received: 'mp4',
      code: 'invalid_enum_value',
      options: [Array],
      path: [Array],
      message: "Invalid enum value. Expected 'jpg' | 'png', received 'mp4'"
    },
    {
      code: 'invalid_type',
      expected: 'string',
      received: 'undefined',
      path: [Array],
      message: 'Required'
    },
    {
      code: 'invalid_type',
      expected: 'number',
      received: 'string',
      path: [Array],
      message: 'Expected number, received string'
    },
    {
      code: 'invalid_type',
      expected: 'date',
      received: 'undefined',
      path: [Array],
      message: 'Required'
    },
    {
      validation: 'url',
      code: 'invalid_string',
      message: 'Invalid url',
      path: [Array]
    },
    {
      code: 'invalid_type',
      expected: 'string',
      received: 'undefined',
      path: [Array],
      message: 'Required'
    },
    {
      expected: "'jpg' | 'png'",
      received: 'undefined',
      code: 'invalid_type',
      path: [Array],
      message: 'Required'
    },
    {
      code: 'invalid_type',
      expected: 'number',
      received: 'undefined',
      path: [Array],
      message: 'Required'
    }
  ],
  addIssue: [Function (anonymous)],
  addIssues: [Function (anonymous)]
}
4.6.5341.7M3
299
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 Module.fn (file:///node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/core/parse.js:17:18)
    at ZodMiniObject.parse (file:///node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/mini/schemas.js:20:22)
    at Object.throw (file:///schemas/dist/benchmarks-CMirnmh3.mjs:206:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
4.6.5341.7M3
173
zod-compiler
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"
  }
]]
2.0.766.44K169
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-QIWSExfk.mjs:242:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
4.6.5341.7M171
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-10-09T11:04:12.697Z,
    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.112.64M49
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.5.0_typescript@7.0.2/node_modules/valibot/dist/index.mjs:7320:28)
    at Object.throw (file:///schemas/dist/benchmarks-Bt3STUpN.mjs:122: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: 'abc',
      expected: 'number',
      received: '"abc"',
      message: 'Invalid type: Expected number but received "abc"',
      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.5.022.42M2
218
typia
Code snippetCode snippet
const assert = typia.createAssert<TypiaSchema>();
assert(data);

(Setup 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 (file:///node_modules/.pnpm/typia@15.1.0_ttsc@0.30.4/node_modules/typia/lib/internal/_assertGuard.mjs:18:9)
    at _ap2 (file:///schemas/dist/benchmarks-CK4zcJdQ.mjs:291:168)
    at _ao0 (file:///schemas/dist/benchmarks-CK4zcJdQ.mjs:328:132)
    at file:///schemas/dist/benchmarks-CK4zcJdQ.mjs:514:26
    at file:///schemas/dist/benchmarks-CK4zcJdQ.mjs:519:22
    at Object.throw (file:///schemas/dist/benchmarks-CK4zcJdQ.mjs:1174:4)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  method: 'typia.createAssert',
  path: '$input.title',
  expected: 'string & MinLength<1>',
  value: ''
}
15.1.0312.95K6
14
typebox
Code snippetCode snippet
Value.Parse(schema, data)
Error outputError output
ParseError: Parse
    at Module.Parse (file:///node_modules/.pnpm/typebox@1.3.36/node_modules/typebox/build/value/parse/parse.mjs:52:11)
    at Object.throw (file:///schemas/dist/benchmarks-D_ZiDnPZ.mjs:334:10)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  [cause]: {
    source: 'Parse',
    errors: [ [Object] ],
    value: {
      id: 252,
      created: 2026-10-09T11:04:12.453Z,
      title: '',
      brand: 'Sunny Backyard',
      description: 'Red apple from Lake Constance',
      price: 0,
      discount: null,
      quantity: 1000,
      tags: [Array],
      images: [Array],
      ratings: [Array]
    }
  }
}
1.3.3613.22M2
23
sury
Code snippetCode snippet
const parse = S.parseOrThrow(S.schema(value));
parse(data)

(Setup code is not benchmarked)

Error outputError output
SuryError: Failed at title: Expected 1 <= string.length <= 100, received ""
    at B_throw (file:///node_modules/.pnpm/sury@11.0.0/node_modules/sury/index.mjs:380:9)
    at Array.<anonymous> (file:///node_modules/.pnpm/sury@11.0.0/node_modules/sury/index.mjs:390:3)
    at eval (eval at compileDecoder (file:///node_modules/.pnpm/sury@11.0.0/node_modules/sury/index.mjs:1048:14), <anonymous>:3:358)
    at Object.throw (file:///schemas/dist/benchmarks-TFGDapyW.mjs:187:4)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  code: 'invalid_input',
  expected: Schema <[Object: null prototype] {}> {
    type: 'string',
    seq: 153,
    decoder: [Function: stringDecoderFn],
    expression: [Function (anonymous)],
    bounds: 3,
    minLength: 1,
    refiner: [Function: boundsRefiner],
    maxLength: 100
  },
  received: Schema <[Object: null prototype] {}> {
    type: 'string',
    seq: 153,
    decoder: [Function: stringDecoderFn],
    expression: [Function (anonymous)],
    bounds: 3,
    minLength: 1,
    refiner: [Function: boundsRefiner],
    maxLength: 100
  },
  path: [ 'title' ],
  reason: 'Expected 1 <= string.length <= 100, received ""',
  unionErrors: undefined,
  input: ''
}
11.0.0472.92K4
33
superstruct
Code snippetCode snippet
assert(data, schema)
Error outputError output
StructError: At path: title -- Expected a value of type `string`, but received: `""`
    at validate (/node_modules/.pnpm/superstruct@2.0.2/node_modules/superstruct/dist/index.cjs:298:27)
    at assert (/node_modules/.pnpm/superstruct@2.0.2/node_modules/superstruct/dist/index.cjs:254:24)
    at Object.throw (file:///schemas/dist/benchmarks-D3e9kAGN.mjs:116:4)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  value: '',
  type: 'string',
  refinement: 'string with length between 1 and 100',
  key: 'title',
  path: [ 'title' ],
  branch: [
    {
      id: 252,
      created: 2026-10-09T11:04:12.052Z,
      title: '',
      brand: 'Sunny Backyard',
      description: 'Red apple from Lake Constance',
      price: 0,
      discount: null,
      quantity: 1000,
      tags: [Array],
      images: [Array],
      ratings: [Array]
    },
    ''
  ],
  failures: [Function (anonymous)]
}
2.0.26.73M3
29
runtypes
Code snippetCode snippet
schema.check(data)
Error outputError output
ValidationError: Expected { id: number; created: Date; title: string; brand: string; description: string; price: number; discount: number | null; quantity: number; tags: string[]; images: { id: number; created: Date; title: string; type: "jpg" | "png"; size: number; url: string; }[]; ratings: { id: number; stars: number; title: string; text: string; images: { id: number; created: Date; title: string; type: "jpg" | "png"; size: number; url: string; }[]; }[]; }, but was incompatible
    at Object.check (file:///node_modules/.pnpm/runtypes@7.0.5/node_modules/runtypes/esm/Runtype.js:119:19)
    at Object.throw (file:///schemas/dist/benchmarks-Bji2hG8P.mjs:81:11)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  failure: {
    success: false,
    message: 'Expected { id: number; created: Date; title: string; brand: string; description: string; price: number; discount: number | null; quantity: number; tags: string[]; images: { id: number; created: Date; title: string; type: "jpg" | "png"; size: number; url: string; }[]; ratings: { id: number; stars: number; title: string; text: string; images: { id: number; created: Date; title: string; type: "jpg" | "png"; size: number; url: string; }[]; }[]; }, but was incompatible',
    code: 'CONTENT_INCORRECT',
    expected: Object [Runtype<{ id: number; created: Date; title: string; brand: string; description: string; price: number; discount: number | null; quantity: number; tags: string[]; images: { id: number; created: Date; title: string; type: "jpg" | "png"; size: number; url: string; }[]; ratings: { id: number; stars: number; title: string; text: string; images: { id: number; created: Date; title: string; type: "jpg" | "png"; size: number; url: string; }[]; }[]; }>] {
      tag: 'object',
      fields: [Object],
      isExact: false
    },
    received: {
      id: 252,
      created: 2026-10-09T11:04:11.787Z,
      title: '',
      brand: 'Sunny Backyard',
      description: 'Red apple from Lake Constance',
      price: 0,
      discount: null,
      quantity: 1000,
      tags: [Array],
      images: [Array],
      ratings: [Array]
    },
    details: {
      title: [Object],
      price: [Object],
      quantity: [Object],
      tags: [Object],
      images: [Object],
      ratings: [Object]
    }
  }
}
7.0.5257.27K2
37
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-10-09T11:04:11.659Z,
    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.2.925.81M24
effect
Code snippetCode snippet
Schema.decodeUnknownSync(schema)(data, { errors: "first" })
Error outputError output
{
  issue: 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: [],
      encodingChecks: undefined
    },
    issues: [ [Pointer] ]
  },
  _tag: 'SchemaError',
  '~effect/Schema/SchemaError': '~effect/Schema/SchemaError'
}
4.0.258.72M21
decoders
Code snippetCode snippet
schema.verify(data)
Error outputError output
Decoding error: 
{
  "id": 252,
  "created": new Date('2026-10-09T11:04:11.259Z'),
  "title": "",
           ^^ Too short, must be at least 1 char
  "brand": "Sunny Backyard",
  "description": "Red apple from Lake Constance",
  "price": 0,
           ^ Too low, must be between 1 and 10000
  "discount": null,
  "quantity": 1000,
              ^^^^ Too high, must be between 0 and 10
  "tags": [
    "fruit",
    null,
    ^^^^ Must be string (at index 1)
    "round",
    undefined,
    "juicy",
    "healthy",
  ],
  "images": [
    {
      "created": null,
                 ^^^^ Must be a Date
      "title": "Close up of an apple on a tree",
      "type": "mp4",
              ^^^^^ Must be one of 'jpg', 'png'
      "size": 92357232,
      "url": "https://www.example.com/images/248",
    },
    ^ Missing key: 'id' (at index 0)
    {
      "id": 295,
      "created": new Date('2026-10-09T11:04:11.259Z'),
      "title": "Our apples in the final packaging",
      "type": "jpg",
      "size": 83247232,
    },
    {
      "id": 723,
      "created": new Date('2026-10-09T11:04:11.259Z'),
      "title": "Our fruit fields at Lake Constance",
      "type": "jpg",
      "size": 72356345,
      "url": "https://www.example.com/images/723",
    },
  ],
  "ratings": [
    {
      "id": 315,
      "stars": 4.5,
      "title": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean ..." [truncated],
      "text": "Tastes super delicious",
      "images": [
        {
          "id": 835,
          "created": new Date('2026-10-09T11:04:11.259Z'),
          "title": "The result of our apple pie",
          "type": "jpg",
          "size": 8247493,
          "url": "https://www.example.com/images/835",
        },
      ],
    },
    {
      "id": 642,
      "stars": 5,
      "title": "Very tasty! I will buy them again!",
      "text": "In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. N..." [truncated],
      "images": [
        {
          "id": "abc",
                ^^^^^ Must be number
          "created": undefined,
          "title": "The fruit salad in a bowl",
          "type": "jpg",
          "size": 3582543,
          "url": "INVALID_URL",
                 ^^^^^^^^^^^^^ Must be URL
        },
        ^ Missing key: 'created' (at index 0)
        {
          "id": 465,
          "created": new Date('2026-10-09T11:04:11.259Z'),
          "url": "https://www.example.com/images/465",
        },
      ],
    },
    ^ index 1
  ],
}
    at format (file:///node_modules/.pnpm/decoders@2.12.2/node_modules/decoders/dist/index.js:366:18)
    at Decoder.verify (file:///node_modules/.pnpm/decoders@2.12.2/node_modules/decoders/dist/index.js:411:15)
    at Object.throw (file:///schemas/dist/benchmarks-IH3-1VHX.mjs:82:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
2.12.237.21K3
98
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.7/node_modules/@ark/schema/out/shared/errors.js:154:16)
    at ArkErrors.throw (file:///node_modules/.pnpm/@ark+schema@0.56.7/node_modules/@ark/schema/out/shared/errors.js:147:20)
    at file:///node_modules/.pnpm/@ark+schema@0.56.7/node_modules/@ark/schema/out/node.js:166:85
    at Traversal.finalize (file:///node_modules/.pnpm/@ark+schema@0.56.7/node_modules/@ark/schema/out/shared/traversal.js:112:29)
    at IntersectionNode.rootApply (file:///node_modules/.pnpm/@ark+schema@0.56.7/node_modules/@ark/schema/out/node.js:118:32)
    at BaseNode.attach (file:///node_modules/.pnpm/@ark+schema@0.56.7/node_modules/@ark/schema/out/node.js:33:25)
    at IntersectionNode.assert (file:///node_modules/.pnpm/@ark+schema@0.56.7/node_modules/@ark/schema/out/node.js:166:42)
    at Object.throw (file:///schemas/dist/benchmarks-lkq8X-XU.mjs:135:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
2.2.82.1M8
26
ajv
Code snippetCode snippet
const validate = ajv.compile(schema);
validate(data);
throw new ValidationError(validate.errors || []);

(Setup code is not benchmarked)

Error outputError output
ValidationError: validation failed
    at Object.throw (file:///schemas/dist/benchmarks-CbDatK3t.mjs:228:10)
    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.20.0393.48M16
@sapphire/shapeshift
Code snippetCode snippet
schema.parse(data)
Error outputError output
CombinedPropertyError (6)
  /eceived one or more errors/

  input.title
  | ExpectedConstraintError > s.string().lengthGreaterThanOrEqual()
  |   /nvalid string length/
  | 
  |   Expected: expected.length >= 1
  | 
  |   /eceived:/
  |   | ''

  input.price
  | ExpectedConstraintError > s.number().greaterThanOrEqual()
  |   /nvalid number value/
  | 
  |   Expected: expected >= 1
  | 
  |   /eceived:/
  |   | 0

  input.quantity
  | ExpectedConstraintError > s.number().lessThanOrEqual()
  |   /nvalid number value/
  | 
  |   Expected: expected <= 10
  | 
  |   /eceived:/
  |   | 1000

  input.tags
  | CombinedPropertyError (2)
  |   /eceived one or more errors/
  | 
  |   input[1]
  |   | ValidationError > s.string()
  |   |   /xpected a string primitive/
  |   | 
  |   |   /eceived:/
  |   |   | null
  | 
  |   input[3]
  |   | ValidationError > s.string()
  |   |   /xpected a string primitive/
  |   | 
  |   |   /eceived:/
  |   |   | undefined

  input.images
  | CombinedPropertyError (2)
  |   /eceived one or more errors/
  | 
  |   input[0]
  |   | CombinedPropertyError (3)
  |   |   /eceived one or more errors/
  |   | 
  |   |   input.id
  |   |   | [MissingPropertyError: id]
  |   | 
  |   |   input.created
  |   |   | [ValidationError: s.date()]
  |   | 
  |   |   input.type
  |   |   | [CombinedError]
  | 
  |   input[1]
  |   | CombinedPropertyError (1)
  |   |   /eceived one or more errors/
  |   | 
  |   |   input.url
  |   |   | [MissingPropertyError: url]

  input.ratings
  | CombinedPropertyError (1)
  |   /eceived one or more errors/
  | 
  |   input[1]
  |   | CombinedPropertyError (1)
  |   |   /eceived one or more errors/
  |   | 
  |   |   input.images
  |   |   | [CombinedPropertyError]

    at _ObjectValidator.handleIgnoreStrategy (file:///node_modules/.pnpm/@sapphire+shapeshift@5.0.0/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:3789:72)
    at _ObjectValidator.handleStrategy (file:///node_modules/.pnpm/@sapphire+shapeshift@5.0.0/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:3654:47)
    at _ObjectValidator.handle (file:///node_modules/.pnpm/@sapphire+shapeshift@5.0.0/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:3759:17)
    at _ObjectValidator.parse (file:///node_modules/.pnpm/@sapphire+shapeshift@5.0.0/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:2652:88)
    at Object.throw (file:///schemas/dist/benchmarks-CuqV2Mlf.mjs:94:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
5.0.01.58M5
90
@remix-run/data-schema
Code snippetCode snippet
parse(schema, data)
Error outputError output
ValidationError: Validation failed
    at parse (file:///node_modules/.pnpm/@remix-run+data-schema@1.0.0/node_modules/@remix-run/data-schema/dist/lib/schema.js:841:15)
    at Object.throw (file:///schemas/dist/benchmarks-C-Mp2YnY.mjs:72:4)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  issues: [
    { message: 'Expected at least 1 characters', path: [Array] },
    {
      message: 'Expected number greater than or equal to 1',
      path: [Array]
    },
    {
      message: 'Expected number less than or equal to 10',
      path: [Array]
    },
    { message: 'Expected string', path: [Array] },
    { message: 'Expected string', path: [Array] },
    { message: 'Expected number', path: [Array] },
    { message: 'Expected instance of Date', path: [Array] },
    { message: 'Expected one of: jpg, png', path: [Array] },
    { message: 'Expected string', path: [Array] },
    { message: 'Expected number', path: [Array] },
    { message: 'Expected instance of Date', path: [Array] },
    { message: 'Expected valid URL', path: [Array] },
    { message: 'Expected string', path: [Array] },
    { message: 'Expected one of: jpg, png', path: [Array] },
    { message: 'Expected number', path: [Array] }
  ]
}
1.0.021.69K2
29
@paseri/paseri
Code snippetCode snippet
p.object(shape).parse(data)
Error outputError output
PaseriError: Failed to parse. See `e.messages()` for details.
    at ObjectSchema.parse (file:///node_modules/.pnpm/@jsr+paseri__paseri@1.9.7/node_modules/@jsr/paseri__paseri/src/schemas/schema.js:99:11)
    at Object.throw (file:///schemas/dist/benchmarks-B7VMCbTl.mjs:91:11)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  _issue: {
    type: 'join',
    left: { type: 'join', left: [Object], right: [Object] },
    right: { type: 'nest', key: 'ratings', child: [Object] }
  }
}
1.9.71.06K2
11
@paseri/compiler
Code snippetCode snippet
schema.parse(data)
Error outputError output
PaseriError: Failed to parse. See `e.messages()` for details.
    at Object.parseProduct [as parse] (file:///schemas/dist/benchmarks-BNeQiyga.mjs:1014:8)
    at Object.throw (file:///schemas/dist/benchmarks-BNeQiyga.mjs:1063:12)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  _issue: {
    type: 'join',
    left: { type: 'join', left: [Object], right: [Object] },
    right: { type: 'nest', key: 'ratings', child: [Object] }
  }
}
0.7.71.05K2
11