Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Standard JSON Schema#134

Merged
colinhacks merged 56 commits into
mainfrom
json-schema
Dec 15, 2025
Merged

Standard JSON Schema#134
colinhacks merged 56 commits into
mainfrom
json-schema

Conversation

@colinhacks

@colinhacks colinhacks commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

This represents a new specification under the Standard Spec umbrella, alongside the existing Standard Schema specification.

RFC: StandardJSONSchema

This RFC proposes the addition of a new spec: StandardJSONSchema. This spec can be implemented by any entity that both:

  • has inferred input/output static types
  • is or can be converted to JSON Schema

This spec provides a standardized, unified JSON Schema representation that preserves inferred type information.


Motivation

Many libraries need JSON Schema representations of type information:

  • API documentation generation (e.g. OpenAPI)
  • Tool inputs and structures outputs for AI
  • Form generation tools
  • Code generation

Previously, type information was commonly destroyed in the process of converting a schema (Zod, ArkType, Valibot) to JSON Schema. This spec provides a standardized, unified JSON Schema representation that preserves inferred type information.


The spec

This new proposal aims to solve that with the addition of a new spec: StandardJSONSchemaV1.

This provides a standardized interface that can be implemented by any JavaScript object/instance/entity that can be converted into a JSON Schema representation. We expect most implementers to be schema libraries, but other libraries (ORMs, form builders, etc.) can also implement it.

// ⚠️ this has been condensed for readability
export interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
  '~standard': {
    readonly version: 1;
    readonly vendor: string;
    readonly types?: {
      readonly input: Input;
      readonly output: Output;
    };
    readonly jsonSchema: {
      readonly input: (options: Options) => Record<string, unknown>;
      readonly output: (options: Options) => Record<string, unknown>;
    };
  };
}

export interface Options {
  // support for `draft-07` and `draft-2020-12` is strongly recommended.
  readonly target: 'draft-07' | 'draft-2020-12' | 'openapi-3.0' | ({} & string);

  // vendor-specific parameters accepted by the implementer's builtin JSON Schema conversion API
  readonly libraryOptions?: Record<string, unknown> | undefined;
}

FAQ

What's the relationship between this and Standard Schema?

Staring with the next @standard-schema/spec version, Standard JSON Schema will be published alongside the existing Standard Schema spec.

Standard JSON Schema is orthogonal to Standard Schema. This interface contains no affordance for data validation. Think of them as "traits" or "interfaces". Any given object/instance/entity can implement one or both.


What schema libraries support this spec?

The answer to this question is a little more nuanced than with regular Standard Schema. The spec can be implemented by any object that represents or can be converted to JSON Schema. It's intentionally designed to support multiple use cases.

If a library directly encapsulates JSON Schema conversion logic within schemas themselves (say, as a method), it can directly implement the spec. If not, the library may provide a toJSONSchema function that returns a value that implements this spec.

function acceptSchema<T extends StandardJSONSchemaV1>(arg: T){ ... }

// Zod
import * as z from "zod";
acceptSchema(z.string());

// ArkType 
import { type } from "arktype";
acceptSchema(type("string");

// Valibot (via v.toJsonSchema)
import { toJsonSchema } from "@valibot/to-json-schema";
import * as v from "valibot";
acceptSchema(toJSONSchema(v.string());

// Zod Mini (via z.toJSONSchema) 
import * as z from "zod/mini"; // also works with regular Zod
acceptSchema(z.toJSONSchema(z.string())

Why multiple target values?

Different tooling requires different versions of JSON Schema. Currently there is a divide in the ecosystem between "draft-07" and "draft-2020-12". Library authors that implement this spec are encouraged to implement as many formats as is practical, which a special emphasis on "draft-07" and "draft-2020-12". Supporting multiple formats is not required to implement the spec; it is entirely on a best-effort basis.


Does the spec account for future versions of JSON Schema?

Yes, the type signature for "target" was intentionally widened with {} & string. This allows libraries to support unspecified formats. It also allows the spec to evolve to include future versions of JSON Schema without breaking assignability down the line.


What's "openapi-3.0"?

The OpenAPI 3.0 specification (still in wide use) implements its own schema definition format. It's a superset of JSON Schema "draft-04" that's augmented with additional keywords like nullable. Despite not being an official JSON Schema draft, it's in wide use and has been included in the list of recommended drafts.


Why both jsonSchema.input and jsonSchema.output?

Many schemas perform transformations during validation. For example, a schema might accept a string as input ("123") but output a number (123). The input and output types can differ, so their JSON Schema representations need to differ as well. The jsonSchema.input method generates a JSON Schema for the input type, while jsonSchema.output generates one for the output type. In cases where input and output types are identical, both methods will return the same schema.


What about error handling?

If a given schema/entity cannot be converted to JSON Schema, the conversion method call may throw. They may also throw if the entity is non-convertible or otherwise cannot be soundly reprsented as JSON Schema. Any integrating frameworks/libraries should account for this.


Why is this a separate spec instead of adding to StandardSchemaV1?

The two concerns are orthogonal. StandardSchemaV1 is about validation, while StandardJSONSchemaV1 is about introspectability and JSON Schema generation. Keeping them separate allows greater flexibility.


I'm a schema library author. How do I implement this spec?

Refer to the implementation example for a worked example.


I want to accept JSON Schema from a user. How do I do that?

Refer to the integration example for a worked example.


What if I want to accept only schemas that implement both StandardSchema and StandardJSONSchema?

The two specs are implemented as plain TypeScript interfaces, so you can merge them (and any future specs) as needed for your use case.

export interface CombinedProps<Input = unknown, Output = Input>
  extends StandardSchemaV1.Props<Input, Output>,
    StandardJSONSchemaV1.Props<Input, Output> {}

/**
 * An interface that combines StandardJSONSchema and StandardSchema.
 * */
export interface CombinedSpec<Input = unknown, Output = Input> {
  '~standard': CombinedProps<Input, Output>;
}

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 18, 2025

Copy link
Copy Markdown

Deploying standard-schema with  Cloudflare Pages  Cloudflare Pages

Latest commit: 395ee95
Status:⚡️  Build in progress...

View logs

@sinclairzx81 sinclairzx81 mentioned this pull request Nov 19, 2025
@kitaharata kitaharata mentioned this pull request Nov 23, 2025

@fabian-hiller fabian-hiller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some details. Rest should be ready. 🔥

Comment thread packages/spec/src/index.ts Outdated
Comment thread packages/spec/src/index.ts Outdated
Comment thread packages/spec/src/index.ts Outdated
Comment thread packages/spec/src/index.ts Outdated
Comment thread packages/spec/src/index.ts Outdated
Comment thread packages/spec/src/index.ts
Comment thread packages/spec/src/index.ts
Comment thread packages/spec/src/index.ts
Comment thread packages/spec/src/index.ts Outdated
@colinhacks colinhacks marked this pull request as ready for review November 28, 2025 18:34
@fabian-hiller fabian-hiller added the enhancement New feature or request label Nov 28, 2025
fabian-hiller
fabian-hiller previously approved these changes Nov 28, 2025

@fabian-hiller fabian-hiller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few smaller notes. Otherwise, I am happy.

Comment thread packages/examples/json-implement.ts
Comment thread packages/examples/json-integrate.ts Outdated
Comment thread packages/examples/json-integrate.ts Outdated
Comment thread packages/examples/json-integrate.ts Outdated
Comment thread packages/spec/src/index.ts Outdated
Comment thread packages/examples/json-implement.ts Outdated
Comment thread packages/spec/src/index.ts Outdated
@dinwwwh

dinwwwh commented Nov 30, 2025

Copy link
Copy Markdown

This looks great! However, since JSON Schema itself can’t represent undefined, I recommend that the input/output result should be a tuple of [required: boolean, jsonSchema: Record<string, unknown>]. For example:

const schema = z.union(z.string(), z.undefined());
schema['~standard'].jsonSchema.output();

// current behavior:
// { anyOf: [ { type: 'string' }, { not: {} } ] }

// expected:
// [false, { type: 'string' }]

This is especially useful when generating OpenAPI specs, since OpenAPI has explicit fields to indicate whether body/query/header/param values are required.

This is something I've mentioned before, just bringing it up again so it's not overlooked.

@ssalbdivad

ssalbdivad commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

I'm not sure how much of the RFC will be carried over to the README but a few thoughts on the body of the PR:

JSON Schema payload

Are we still planning to use this terminology as opposed to something less prescriptive like "JSON Schema Source"?

// support for any vendor-specific parameters

I would word this differently e.g. "vendor-specific parameters accepted by the implementer's builtin JSON Schema conversion API"

This is the 1.0 release of a new spec called Standard JSON Schema. The Standard Schema spec remains unchanged.

Maybe something like:

Staring with the next @standard-schema/spec version, Standard JSON Schema will be published alongside the existing Standard Schema spec.

Standard JSON Schema is orthogonal to Standard Schema. This interface contains no affordance for data validation. Think of them as "traits" or "interfaces". Any given object/instance/entity can implement one or both.

@ssalbdivad

ssalbdivad commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator

@unnoq I see two relevant scenarios here:

  1. optional properties exist on objects/tuples and can be specified as such via JSON Schema
  2. optional values are standalone (as in the example) and have ambiguous semantics regarding validation of undefined, either collapsing back to a union with undefined or behaving identically to the original type

Because of 2, ArkType has no concept of a "shallow optional" value like this- .optional() returns a definition that can be referenced from within an object or tuple definition, not a standalone Type.

Let me know if I'm missing something about how you'd expect this to be used, but as it stands I'd want to avoid baking this can of worms into the spec.

ssalbdivad
ssalbdivad previously approved these changes Dec 1, 2025

@ssalbdivad ssalbdivad left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple very minor notes. Look great, excited to ship this 😄

Comment thread packages/spec/src/index.ts Outdated
Comment thread packages/spec/src/index.ts Outdated
Comment thread packages/spec/src/index.ts
@gcanti

gcanti commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

ArkType has no concept of a "shallow optional" value like this- .optional() returns a definition that can be referenced from within an object or tuple definition, not a standalone Type

Effect Schema works the same way, +1 to

avoid baking this into the spec

@AlemTuzlak

Copy link
Copy Markdown

Any ETA on this? We would love to use this in TanStack AI!

renovate Bot added a commit to clentfort/adameter that referenced this pull request Dec 15, 2025
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | [`4.1.13` ->
`4.2.0`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.0) |
![age](https://developer.mend.io/api/mc/badges/age/npm/zod/4.2.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zod/4.1.13/4.2.0?slim=true)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/clentfort/adameter).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Mi4yIiwidXBkYXRlZEluVmVyIjoiNDIuNDIuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate Bot added a commit to inabagumi/shinju-date that referenced this pull request Dec 15, 2025
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Adoption](https://docs.renovatebot.com/merge-confidence/) |
[Passing](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | [`4.1.13` ->
`4.2.0`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.0) |
![age](https://developer.mend.io/api/mc/badges/age/npm/zod/4.2.0?slim=true)
|
![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/zod/4.2.0?slim=true)
|
![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/zod/4.1.13/4.2.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zod/4.1.13/4.2.0?slim=true)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/inabagumi/shinju-date).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Mi4yIiwidXBkYXRlZEluVmVyIjoiNDIuNDIuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiYm90OiByZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate Bot added a commit to mgurov/lokito that referenced this pull request Dec 15, 2025
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | [`4.1.13` ->
`4.2.0`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.0) |
![age](https://developer.mend.io/api/mc/badges/age/npm/zod/4.2.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zod/4.1.13/4.2.0?slim=true)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/mgurov/lokito).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Mi4yIiwidXBkYXRlZEluVmVyIjoiNDIuNDIuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@colinhacks

Copy link
Copy Markdown
Contributor Author

cc @pullfrog review this

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comprehensive review complete. Found one critical issue in the examples that will prevent type-checking from passing. The spec implementation looks solid and well-designed.

Pullfrog  | Fix all ➔Fix 👍s ➔pullfrog.com𝕏

Comment thread packages/examples/json-integrate.ts Outdated
*/
import { toJsonSchema } from "@valibot/to-json-schema"; // adds JSON Schema conversion methods

acceptStandardJSONSchema(toJsonSchema(v.string()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v is not defined or imported. This should be import * as v from "valibot" at the top, or the example should use a qualified reference like v.string().

Comment thread packages/examples/json-implement.ts
Comment thread packages/spec/src/index.ts
Comment thread packages/spec/json-schema.md
@colinhacks colinhacks merged commit 2c4e37f into main Dec 15, 2025
3 of 4 checks passed
RobinTail added a commit to RobinTail/express-zod-api that referenced this pull request Dec 15, 2025
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | [`4.1.13` ->
`4.2.0`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.0) |
![age](https://developer.mend.io/api/mc/badges/age/npm/zod/4.2.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zod/4.1.13/4.2.0?slim=true)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/RobinTail/express-zod-api).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Mi4yIiwidXBkYXRlZEluVmVyIjoiNDIuNDIuMiIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Anna Bocharova <[email protected]>
@colinhacks

colinhacks commented Dec 15, 2025

Copy link
Copy Markdown
Contributor Author

This has landed in @standard-schema/[email protected].

Announcement post: https://x.com/colinhacks/status/2000704277606752450
GitHub release: https://github.com/standard-schema/standard-schema/releases/tag/v1.1.0

renovate Bot added a commit to settlemint/docs that referenced this pull request Dec 15, 2025
This PR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | dependencies |
minor | [`4.1.13` ->
`4.2.0`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.0) |
[![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/colinhacks/zod/badge)](https://securityscorecards.dev/viewer/?uri=github.com/colinhacks/zod)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At 12:00 AM through 04:59 AM and 10:00
PM through 11:59 PM, Monday through Friday ( * 0-4,22-23 * * 1-5 ), Only
on Sunday and Saturday ( * * * * 0,6 ) (UTC), Automerge - At any time
(no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/settlemint/docs).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41NC4yIiwidXBkYXRlZEluVmVyIjoiNDIuNTQuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Updated zod to 4.2.0 to add Standard JSON Schema support and new
helpers: z.fromJSONSchema, z.xor, and z.looseRecord. Minor version bump;
no code changes needed.

<sup>Written for commit 50e8093.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
lgrammel added a commit to vercel/ai that referenced this pull request Dec 16, 2025
## Background

Standard JSON Schema was released as part of Standard Schema 1.1.0 (see
standard-schema/standard-schema#134 ). This
enables integration of any schema library that supports Standard JSON
Schema.

Additionally, the current peer dependency mechanism has issues in
certain environments (see #10122 ).

## Summary

* remove direct Effect, Arktype, and Valibot integrations
* support Standard JSON Schema

## Manual Verification

- [x] test zod direct
`examples/ai-core/src/generate-text/anthropic-output-object-zod.ts`
- [x] test zod v4
`examples/ai-core/src/generate-text/anthropic-output-object-zod4.ts`
- [x] test arktype
`examples/ai-core/src/generate-text/anthropic-output-object-arktype.ts`
- [x] test valibot
`examples/ai-core/src/generate-text/anthropic-output-object-valibot.ts`

## Future Work

* improve schema library support documentation

## Related Issues

Fixes #10122 
Resolves #11044

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
renovate Bot added a commit to settlemint/network-bootstrapper that referenced this pull request Dec 16, 2025
This PR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | dependencies |
minor | [`4.1.13` ->
`4.2.1`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.1) |
[![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/colinhacks/zod/badge)](https://securityscorecards.dev/viewer/?uri=github.com/colinhacks/zod)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.1`](https://redirect.github.com/colinhacks/zod/compare/v4.2.0...5b5b129315fbc94a3b0d6244185eaeefcbe438d1)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.2.0...v4.2.1)

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At 12:00 AM through 04:59 AM and 10:00
PM through 11:59 PM, Monday through Friday ( * 0-4,22-23 * * 1-5 ), Only
on Sunday and Saturday ( * * * * 0,6 ) (UTC), Automerge - At any time
(no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/settlemint/network-bootstrapper).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41NC4yIiwidXBkYXRlZEluVmVyIjoiNDIuNTQuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate Bot added a commit to flint-fyi/flint that referenced this pull request Dec 18, 2025
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | [`4.1.12` ->
`4.2.0`](https://renovatebot.com/diffs/npm/zod/4.1.12/4.2.0) |
![age](https://developer.mend.io/api/mc/badges/age/npm/zod/4.2.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zod/4.1.12/4.2.0?slim=true)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

###
[`v4.1.13`](https://redirect.github.com/colinhacks/zod/compare/v4.1.12...4063e802d539d04182fc3e66a543ae6d1ba5658e)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.12...v4.1.13)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/JoshuaKGoldberg/flint).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
github-merge-queue Bot pushed a commit to infonl/dimpact-zaakafhandelcomponent that referenced this pull request Dec 18, 2025
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | [`4.1.13` ->
`4.2.0`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.0) |
![age](https://developer.mend.io/api/mc/badges/age/npm/zod/4.2.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zod/4.1.13/4.2.0?slim=true)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/infonl/dimpact-zaakafhandelcomponent).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate Bot added a commit to divvi-xyz/divvi-mcp-server that referenced this pull request Dec 18, 2025
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | [`^4.1.13` ->
`^4.2.0`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.0) |
![age](https://developer.mend.io/api/mc/badges/age/npm/zod/4.2.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zod/4.1.13/4.2.0?slim=true)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - "after 8:00 before 23:00 every weekday except on Friday" in
timezone UTC.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/divvi-xyz/divvi-mcp-server).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsibnBtIiwicmVub3ZhdGUiXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
ykzts pushed a commit to ykzts/ykzts that referenced this pull request Dec 21, 2025
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [zod](https://zod.dev)
([source](https://redirect.github.com/colinhacks/zod)) | [`4.1.13` ->
`4.2.1`](https://renovatebot.com/diffs/npm/zod/4.1.13/4.2.1) |
![age](https://developer.mend.io/api/mc/badges/age/npm/zod/4.2.1?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zod/4.1.13/4.2.1?slim=true)
|

---

### Release Notes

<details>
<summary>colinhacks/zod (zod)</summary>

###
[`v4.2.1`](https://redirect.github.com/colinhacks/zod/compare/v4.2.0...5b5b129315fbc94a3b0d6244185eaeefcbe438d1)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.2.0...v4.2.1)

###
[`v4.2.0`](https://redirect.github.com/colinhacks/zod/releases/tag/v4.2.0)

[Compare
Source](https://redirect.github.com/colinhacks/zod/compare/v4.1.13...v4.2.0)

#### Features

##### Implement Standard JSON Schema


[standard-schema/standard-schema#134](https://redirect.github.com/standard-schema/standard-schema/pull/134)

##### Implement `z.fromJSONSchema()`

```typescript
const jsonSchema = {
  type: "object",
  properties: {
    name: { type: "string" },
    age: { type: "number" }
  },
  required: ["name"]
};

const schema = z.fromJSONSchema(jsonSchema);
```

##### Implement `z.xor()`

```typescript
const schema = z.xor(
  z.object({ type: "user", name: z.string() }),
  z.object({ type: "admin", role: z.string() })
);
// Exactly one of the schemas must match
```

##### Implement `z.looseRecord()`

```typescript
const schema = z.looseRecord(z.string(), z.number());
// Allows additional properties beyond those defined
```

#### Commits:

-
[`af49c08`](https://redirect.github.com/colinhacks/zod/commit/af49c084f66339110d00e37ff71dc7b3b9f2b7ef)
Update docs for JSON Schema conversion of `z.undefined()`
([#&#8203;5504](https://redirect.github.com/colinhacks/zod/issues/5504))
-
[`767f320`](https://redirect.github.com/colinhacks/zod/commit/767f320318986e422f524b939f1a7174544fda2e)
Add `.toJSONSchema()` method
([#&#8203;5477](https://redirect.github.com/colinhacks/zod/issues/5477))
-
[`e17dcb6`](https://redirect.github.com/colinhacks/zod/commit/e17dcb63573397063e87d7c7fe10a5a78968181a)
Add `z.fromJSONSchema()`, `z.looseRecord()`, `z.xor()`
([#&#8203;5534](https://redirect.github.com/colinhacks/zod/issues/5534))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/ykzts/ykzts).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@sandros94 sandros94 mentioned this pull request Feb 6, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.