---
cover: Valibot v1.2
title: 'Valibot v1.2: Type coercion, AI metadata, and ISBN validation'
description: >-
  Valibot v1.2 adds powerful transformation actions for type coercion, new
  metadata features to improve AI tool integration, and ISBN validation.
published: 2025-11-24
authors:
  - fabian-hiller
  - EskiMojo14
  - flySewa
---

import { Link } from '~/components';

Valibot v1.2 adds powerful transformation actions for type coercion, new metadata features to improve AI tool integration, and ISBN validation. These additions make it easier to work with forms, APIs, and AI-powered applications while maintaining Valibot's modular design and minimal bundle size.

> This release also includes an important security fix for a ReDoS vulnerability in the <Link href="/api/emoji/">`emoji`</Link> action. If you're using this action, we strongly recommend upgrading as soon as possible.

Huge thanks to [@EskiMojo14](https://github.com/EskiMojo14) for implementing type coercion and examples metadata, and to [@ysknsid25](https://github.com/ysknsid25), a certified librarian, for contributing ISBN validation.

## Type coercion actions

Five new transformation actions make type coercion straightforward: <Link href="/api/toBigint/">`toBigint`</Link>, <Link href="/api/toBoolean/">`toBoolean`</Link>, <Link href="/api/toDate/">`toDate`</Link>, <Link href="/api/toNumber/">`toNumber`</Link>, and <Link href="/api/toString/">`toString`</Link>.

Perfect for HTML forms and query parameters where everything arrives as strings. These actions use JavaScript's native coercion functions with added error handling. For example, `toNumber` checks for `NaN` after conversion, and `toDate` validates that the resulting date is valid.

```ts
import * as v from 'valibot';

// Coerce form data to proper types
const FormSchema = v.object({
  quantity: v.pipe(v.string(), v.toNumber()),
  balance: v.pipe(v.string(), v.toBigint()),
  createdAt: v.pipe(v.string(), v.toDate()),
});

// Input: { quantity: '25', balance: '1000', createdAt: '2025-11-23' }
// Output: { quantity: 25, balance: 1000n, createdAt: Date }
```

Unlike Zod's `z.coerce`, Valibot's coercion actions can be composed anywhere in your pipeline, giving you precise control over when and how transformations occur.

```ts
const QuerySchema = v.object({
  page: v.pipe(
    v.string(),
    v.toNumber(),
    v.integer(),
    v.minValue(1),
    v.maxValue(999)
  ),
  limit: v.pipe(
    v.string(),
    v.toNumber(),
    v.integer(),
    v.minValue(1),
    v.maxValue(100)
  ),
});
```

## Examples for AI tools and documentation

As AI-powered applications become standard, providing machine-readable metadata about your schemas is increasingly important. The new <Link href="/api/examples/">`examples()`</Link> action lets you attach example values to any schema.

```ts
import * as v from 'valibot';

const UserSchema = v.object({
  id: v.pipe(
    v.string(),
    v.uuid(),
    v.examples(['550e8400-e29b-41d4-a716-446655440000'])
  ),
  name: v.pipe(
    v.string(),
    v.nonEmpty(),
    v.examples(['Alice Smith', 'Bob Johnson'])
  ),
  email: v.pipe(
    v.string(),
    v.email(),
    v.examples(['alice@example.com', 'bob@example.com'])
  ),
});

// Extract email examples
const emailExamples = v.getExamples(UserSchema.entries.email);
```

When multiple <Link href="/api/examples/">`examples()`</Link> actions appear in a pipeline, <Link href="/api/getExamples/">`getExamples()`</Link> automatically concatenates them using depth-first search, giving you a complete list of all examples in the schema tree. Use this for AI tool integration, generating documentation, or creating test fixtures.

## ISBN validation

Thanks to [@ysknsid25](https://github.com/ysknsid25), a certified librarian, we now have built-in <Link href="/api/isbn/">`isbn()`</Link> validation for both ISBN-10 and ISBN-13 formats.

```ts
import * as v from 'valibot';

const BookSchema = v.object({
  title: v.pipe(v.string(), v.nonEmpty()),
  isbn: v.pipe(v.string(), v.isbn('The ISBN is badly formatted.')),
  author: v.pipe(v.string(), v.nonEmpty()),
});

// Valid ISBN-10 formats:
// '0-306-40615-2', '0306406152', '0 306 40615 2'

// Valid ISBN-13 formats:
// '978-0-306-40615-7', '9780306406157', '978 0 306 40615 7'
```

The action accepts hyphens and spaces as separators and validates the checksum to ensure mathematical correctness. Perfect for library management systems, bookstores, or any application handling book identifiers.

## Security fix: ReDoS vulnerability

This release also includes an important security fix for a ReDoS (Regular Expression Denial of Service) vulnerability in the `EMOJI_REGEX` pattern used by the <Link href="/api/emoji/">`emoji`</Link> action. If you're using the <Link href="/api/emoji/">`emoji`</Link> action in your application, we strongly recommend upgrading to v1.2 as soon as possible.

The vulnerability could allow an attacker to cause excessive CPU usage by providing specially crafted input strings. We've updated the regex pattern to eliminate this risk while maintaining the same validation functionality. Thank you to [@makenowjust](https://github.com/makenowjust) for finding and responsibly disclosing this issue.

## Faster builds with tsdown

We've switched from tsup to [tsdown](https://www.npmjs.com/package/tsdown) (built on [Rolldown](https://rolldown.rs/), which uses Valibot for validation). This speeds up our build times.

## New partner announcement

We're excited to welcome [LambdaTest](https://lambdatest.com/) as a new partner! LambdaTest is a leading cloud-based testing platform that helps developers test their web applications across 3000+ browsers and operating systems. If your company uses Valibot and benefits from our work, please consider supporting the project through [GitHub sponsors](https://github.com/open-circle/valibot).

## What's next?

We're creating more guides to help you get the most out of Valibot. Got a specific use case or pattern you'd like us to cover? Let us know on [Discord](https://discord.gg/w5mRTETqzv) or open a discussion on [GitHub](https://github.com/open-circle/valibot/discussions).

New to Valibot? [Get started](/start). Coming from Zod? [Migration guide](/migration). [Full changelog](https://github.com/open-circle/valibot/releases/tag/v1.2.0).
