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
Expand sidebarExpand sidebar
Benchmarks/StackStack
github
GitHubGitHub
DiscordDiscord
PreferencesPreferences

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

Copy to clipboardCopy to clipboard
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
@sapphire/shapeshift
Code snippetCode snippet
schema.parse(data)
Error outputError output
CombinedPropertyError (6)
  Received one or more errors

  input.title
  | ExpectedConstraintError > s.string().lengthGreaterThanOrEqual()
  |   Invalid string length
  | 
  |   Expected: expected.length >= 1
  | 
  |   Received:
  |   | ''

  input.price
  | ExpectedConstraintError > s.number().greaterThanOrEqual()
  |   Invalid number value
  | 
  |   Expected: expected >= 1
  | 
  |   Received:
  |   | 0

  input.quantity
  | ExpectedConstraintError > s.number().lessThanOrEqual()
  |   Invalid number value
  | 
  |   Expected: expected <= 10
  | 
  |   Received:
  |   | 1000

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

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

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

    at _ObjectValidator.handleIgnoreStrategy (file:///node_modules/.pnpm/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:2111:72)
    at _ObjectValidator.handleStrategy (file:///node_modules/.pnpm/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:1975:47)
    at _ObjectValidator.handle (file:///node_modules/.pnpm/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:2081:17)
    at _ObjectValidator.parse (file:///node_modules/.pnpm/@sapphire+shapeshift@4.0.0/node_modules/@sapphire/shapeshift/dist/esm/index.mjs:964:90)
    at Object.throw (file:///schemas/dist/benchmarks-Bk7MBjST.mjs:94:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
4.0.0924.27K90
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-BVb8FqE7.mjs:205: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.0306.93M16
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-Bp1nAJ2L.mjs:81:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
2.2.0980.45K26
decoders
Code snippetCode snippet
schema.verify(data)
Error outputError output
Decoding error: 
{
  "id": 252,
  "created": new Date('2026-05-22T11:58:11.515Z'),
  "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 1 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-05-22T11:58:11.515Z'),
      "title": "Our apples in the final packaging",
      "type": "jpg",
      "size": 83247232,
    },
    {
      "id": 723,
      "created": new Date('2026-05-22T11:58:11.515Z'),
      "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-05-22T11:58:11.515Z'),
          "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": "352",
                ^^^^^ 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-05-22T11:58:11.515Z'),
          "url": "https://www.example.com/images/465",
        },
      ],
    },
    ^ index 1
  ],
}
    at format (file:///node_modules/.pnpm/decoders@2.9.3/node_modules/decoders/dist/index.js:332:18)
    at Object.verify (file:///node_modules/.pnpm/decoders@2.9.3/node_modules/decoders/dist/index.js:351:13)
    at Object.throw (file:///schemas/dist/benchmarks-CYUwU7si.mjs:82:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
2.9.354.37K98
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<minLength(1) & maxLength(30)>
│     ├─ [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.21.2/node_modules/effect/dist/esm/ParseResult.js:241:36)
    at file:///node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/esm/Either.js:197:78
    at Module.<anonymous> (file:///node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/esm/Function.js:98:18)
    at file:///node_modules/.pnpm/effect@3.21.2/node_modules/effect/dist/esm/Schema.js:353:42
    at Object.throw (file:///schemas/dist/benchmarks-B8Jr0EYq.mjs:126:19)
    at file:///bench/src/scripts/stack/log.ts:24:28
3.21.215.35M78
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.70/node_modules/effect/dist/SchemaParser.js:552:99
    at file:///node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/effect.js:1069:19
    at file:///node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/Function.js:73:18
    at file:///node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/internal/effect.js:1020:85
    at Module.<anonymous> (file:///node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/Function.js:73:18)
    at file:///node_modules/.pnpm/effect@4.0.0-beta.70/node_modules/effect/dist/SchemaParser.js:552:52
    at Object.throw (file:///schemas/dist/benchmarks-Bl741nwu.mjs:124:36)
    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.7015.35M28
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-05-22T11:58:12.694Z,
    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.121.03M24
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.4/node_modules/runtypes/esm/Runtype.js:119:19)
    at Object.throw (file:///schemas/dist/benchmarks-8LVzeztO.mjs:82: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-05-22T11:58:12.844Z,
      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.4295.87K37
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-Cr6rnvgp.mjs:112: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-05-22T11:58:12.963Z,
      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.25.19M29
sury
Code snippetCode snippet
// const parser = S.parser(S.schema(...));
parser(data)

(Commented code is not benchmarked)

Error outputError output
SuryError: Failed at ["title"]: String must be 1 or more characters long
    at Array.<anonymous> (file:///node_modules/.pnpm/sury@11.0.0-alpha.5/node_modules/sury/src/Sury.res.mjs:627:11)
    at eval (eval at compileDecoder (file:///node_modules/.pnpm/sury@11.0.0-alpha.5/node_modules/sury/src/Sury.res.mjs:1612:12), <anonymous>:3:407)
    at Object.throw (file:///schemas/dist/benchmarks-mcKAWpOd.mjs:101:4)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  code: 'invalid_input',
  path: '["title"]',
  reason: 'String must be 1 or more characters long',
  expected: Schema <[Object: null prototype] {}> {
    type: 'string',
    seq: 73,
    decoder: [Function: stringDecoderFn],
    maxLength: 100,
    errorMessage: {
      maxLength: 'String must be 100 or fewer characters long',
      minLength: 'String must be 1 or more characters long'
    },
    refiner: [Function (anonymous)],
    minLength: 1
  },
  received: Schema <[Object: null prototype] {}> {
    type: 'string',
    seq: 73,
    decoder: [Function: stringDecoderFn],
    maxLength: 100,
    errorMessage: {
      maxLength: 'String must be 100 or fewer characters long',
      minLength: 'String must be 1 or more characters long'
    },
    refiner: [Function (anonymous)],
    minLength: 1
  },
  unionErrors: undefined,
  input: ''
}
11.0.0-alpha.5231.93K36
typebox
Code snippetCode snippet
Value.Parse(schema, data)
Error outputError output
ParseError: Parse
    at Module.Parse (file:///node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/value/parse/parse.mjs:46:11)
    at Object.throw (file:///schemas/dist/benchmarks-BSE4N9E-.mjs:301:10)
    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-05-22T11:58:13.339Z,
      title: '',
      brand: 'Sunny Backyard',
      description: 'Red apple from Lake Constance',
      price: 0,
      discount: null,
      quantity: 1000,
      tags: [Array],
      images: [Array],
      ratings: [Array]
    }
  }
}
1.1.382.18M28
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 (file:///node_modules/.pnpm/typia@12.1.1_@types+node@25.9.1_typescript@6.0.3/node_modules/typia/lib/internal/_assertGuard.mjs:8:19)
    at _ao0 (file:///schemas/dist/benchmarks-BwHsfmvl.mjs:324:119)
    at file:///schemas/dist/benchmarks-BwHsfmvl.mjs:607:26
    at file:///schemas/dist/benchmarks-BwHsfmvl.mjs:612:22
    at Object.throw (file:///schemas/dist/benchmarks-BwHsfmvl.mjs:1320:4)
    at file:///bench/src/scripts/stack/log.ts:24:28 {
  method: 'typia.createAssert',
  path: '$input.title',
  expected: 'string & MinLength<1>',
  value: '',
  description: undefined,
  fake_expected_typed_value_: undefined
}
12.1.1309.88K15
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.4.0_typescript@6.0.3/node_modules/valibot/dist/index.mjs:7380:28)
    at Object.throw (file:///schemas/dist/benchmarks-wv7JBmps.mjs:98: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.4.011.35M218
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-05-22T11:58:13.831Z,
    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.111.8M49
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-BQdoJiyD.mjs:90:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
4.4.3181.19M171
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-PH3p_7a3.mjs:90:11)
    at file:///bench/src/scripts/stack/log.ts:24:28
4.4.3181.19M171
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.4.3/node_modules/zod/v3/types.js:39:31)
    at ZodObject.parse (file:///node_modules/.pnpm/zod@4.4.3/node_modules/zod/v3/types.js:114:22)
    at Object.throw (file:///schemas/dist/benchmarks-toqARR7p.mjs:78: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.4.3181.19M299
Created by eskimojo for Open Circle

Preferences

Style
Theme
NPM browser