<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/json-schema-package-upgrade-zphg9prho" -->

---
title: JSON Schema package upgrade | daily.dev
description: Valibot's JSON Schema conversion package has grown to nearly 200,000 monthly npm downloads, driven by use in documentation, OpenAPI code generation, and...
canonical: https://daily.dev/posts/json-schema-package-upgrade-zphg9prho
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: JSON Schema package upgrade | daily.dev
og:description: Valibot's JSON Schema conversion package has grown to nearly 200,000 monthly npm downloads, driven by use in documentation, OpenAPI code generation, and...
og:url: https://daily.dev/posts/json-schema-package-upgrade-zphg9prho
og:image: https://api.daily.dev/og/posts/zPHg9PRhO.png
og:image:alt: JSON Schema package upgrade
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# JSON Schema package upgrade

**[Valibot: The modular and type safe schema library](https://daily.dev/sources/valibot)** · 5 min read · 0 upvotes · 0 comments

## Summary

Valibot's JSON Schema conversion package has grown to nearly 200,000 monthly npm downloads, driven by use in documentation, OpenAPI code generation, and structured LLM outputs. The last two minor releases add several new features: a typeMode option to convert either the input or output side of schemas with transformations; overrideSchema, overrideAction, and overrideRef callbacks for customizing conversion behavior; a global definition storage via addGlobalDefs for representing reused schemas as references; a toJsonSchemaDefs function paired with overrideRef for generating standalone schema definitions (useful for OpenAPI); and enhanced metadata support so title, description, and examples can be set through the generic metadata action instead of separate actions. A Zod-to-Valibot codemod is planned next.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://valibot.dev/blog/json-schema-package-upgrade>

## Questions this post answers

### How do I convert only the input or output side of a Valibot schema to JSON Schema when it has transformations?

Use the typeMode configuration option in toJsonSchema, set to either 'input' or 'output'. For a schema piping string, decimal, transform to number, and maxValue, typeMode 'input' produces a string schema with a decimal pattern, while typeMode 'output' produces a number schema with a maximum constraint. This is useful for API endpoints where request and response schemas differ due to transformations.

_daily.dev surfaces library updates like this for developers building typed API contracts with Valibot._

### How do I override the default JSON Schema output for a specific Valibot schema type, like converting a date schema to a string with date-time format?

Pass an overrideSchema function in the toJsonSchema options; it receives full context including the Valibot schema and can return a custom JSON Schema object, or return null/undefined to fall back to default conversion. For example, checking if context.valibotSchema.type is 'date' and returning { type: 'string', format: 'date-time' } replaces the default date conversion. Related overrideAction and overrideRef options work the same way for actions and references.

_developers customizing schema conversion pipelines can track tooling changes like this via daily.dev._

### How can I generate only JSON Schema definitions with custom reference IDs for use with OpenAPI in Valibot?

Use the toJsonSchemaDefs function together with the overrideRef option. Passing a map of named Valibot schemas to toJsonSchemaDefs returns just their definitions, and overrideRef lets you customize the $ref paths, for example rewriting them to '#/schemas/{referenceId}' instead of the default '#/$defs/' format expected by OpenAPI tooling.

_daily.dev helps developers stay current on schema tooling as they wire up OpenAPI generation workflows._

## Similar posts on daily.dev

- [Valibot v1.5: Faster schema construction, Unicode code points, and stricter validation](https://daily.dev/posts/valibot-v1-5-faster-schema-construction-unicode-code-points-and-stricter-validation-fcqzm9kyo) · Valibot: The modular and type safe schema library · 5 upvotes · 1 comments
- [Zod \+ TypeScript: Schema Validation Made Easy](https://daily.dev/posts/zod-typescript-schema-validation-made-easy-w9edwu63u) · Telerik · 1 upvotes · 1 comments
- [Zod: Type-Safe Schema Validation for TypeScript](https://daily.dev/posts/zod-type-safe-schema-validation-for-typescript-ea5i1fg8l) · Flavio Copes · 1 upvotes · 0 comments
- [Lessons from Upgrading a Large TypeScript App to Zod 4](https://daily.dev/posts/lessons-from-upgrading-a-large-typescript-app-to-zod-4-pjirn6kxz) · Viget · 7 upvotes · 0 comments
- [Testing LLM Output in CI with Vitest and Schema Validation](https://daily.dev/posts/testing-llm-output-in-ci-with-vitest-and-schema-validation-ecvs0un9p) · SitePoint · 0 upvotes · 0 comments

---

Tags: [#typescript](https://daily.dev/tags/typescript), [#openapi](https://daily.dev/tags/openapi)

[View this post on daily.dev](https://daily.dev/posts/json-schema-package-upgrade-zphg9prho)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"JSON Schema package upgrade","url":"https://daily.dev/posts/json-schema-package-upgrade-zphg9prho","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/json-schema-package-upgrade-zphg9prho"},"datePublished":"2026-08-23T12:20:01.851Z","dateModified":"2026-08-23T12:44:21.042Z","description":"Valibot's JSON Schema conversion package has grown to nearly 200,000 monthly npm downloads, driven by use in documentation, OpenAPI code generation, and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5342114016f53f54484dab94510f9c91?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5342114016f53f54484dab94510f9c91?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Valibot: The modular and type safe schema library","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Valibot: The modular and type safe schema library","logo":"https://media.daily.dev/image/upload/s--GHNQZY4x--/f_auto,q_auto/v1787487507/logos/valibot?_a=BAMAMicg0","url":"https://daily.dev/sources/valibot"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/json-schema-package-upgrade-zphg9prho","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"typescript,openapi","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Valibot: The modular and type safe schema library","item":"https://daily.dev/sources/valibot"},{"@type":"ListItem","position":3,"name":"JSON Schema package upgrade"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/json-schema-package-upgrade-zphg9prho#faq","mainEntity":[{"@type":"Question","name":"How do I convert only the input or output side of a Valibot schema to JSON Schema when it has transformations?","acceptedAnswer":{"@type":"Answer","text":"Use the typeMode configuration option in toJsonSchema, set to either 'input' or 'output'. For a schema piping string, decimal, transform to number, and maxValue, typeMode 'input' produces a string schema with a decimal pattern, while typeMode 'output' produces a number schema with a maximum constraint. This is useful for API endpoints where request and response schemas differ due to transformations. daily.dev surfaces library updates like this for developers building typed API contracts with Valibot."}},{"@type":"Question","name":"How do I override the default JSON Schema output for a specific Valibot schema type, like converting a date schema to a string with date-time format?","acceptedAnswer":{"@type":"Answer","text":"Pass an overrideSchema function in the toJsonSchema options; it receives full context including the Valibot schema and can return a custom JSON Schema object, or return null/undefined to fall back to default conversion. For example, checking if context.valibotSchema.type is 'date' and returning { type: 'string', format: 'date-time' } replaces the default date conversion. Related overrideAction and overrideRef options work the same way for actions and references. developers customizing schema conversion pipelines can track tooling changes like this via daily.dev."}},{"@type":"Question","name":"How can I generate only JSON Schema definitions with custom reference IDs for use with OpenAPI in Valibot?","acceptedAnswer":{"@type":"Answer","text":"Use the toJsonSchemaDefs function together with the overrideRef option. Passing a map of named Valibot schemas to toJsonSchemaDefs returns just their definitions, and overrideRef lets you customize the $ref paths, for example rewriting them to '#/schemas/{referenceId}' instead of the default '#/$defs/' format expected by OpenAPI tooling. daily.dev helps developers stay current on schema tooling as they wire up OpenAPI generation workflows."}}]}
```

