zod 3.25.24 → 3.25.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -205,8 +205,14 @@ class JSONSchemaGenerator {
205
205
  json.required = Array.from(requiredKeys);
206
206
  // catchall
207
207
  if (def.catchall?._zod.def.type === "never") {
208
+ // strict
208
209
  json.additionalProperties = false;
209
210
  }
211
+ else if (!def.catchall) {
212
+ // regular
213
+ if (this.io === "output")
214
+ json.additionalProperties = false;
215
+ }
210
216
  else if (def.catchall) {
211
217
  json.additionalProperties = this.process(def.catchall, {
212
218
  ...params,
@@ -201,8 +201,14 @@ export class JSONSchemaGenerator {
201
201
  json.required = Array.from(requiredKeys);
202
202
  // catchall
203
203
  if (def.catchall?._zod.def.type === "never") {
204
+ // strict
204
205
  json.additionalProperties = false;
205
206
  }
207
+ else if (!def.catchall) {
208
+ // regular
209
+ if (this.io === "output")
210
+ json.additionalProperties = false;
211
+ }
206
212
  else if (def.catchall) {
207
213
  json.additionalProperties = this.process(def.catchall, {
208
214
  ...params,
@@ -16,7 +16,7 @@ export interface ZodType<out Output = unknown, out Input = unknown> extends core
16
16
  clone(def?: this["_zod"]["def"], params?: {
17
17
  parent: boolean;
18
18
  }): this;
19
- register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$ZodRegistry<R["_meta"], this>["_meta"]?] : [core.$ZodRegistry<R["_meta"], this>["_meta"]] : ["Incompatible schema"]): this;
19
+ register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$replace<R["_meta"], this>?] : [core.$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
20
20
  brand<T extends PropertyKey = PropertyKey>(value?: T): PropertyKey extends T ? this : core.$ZodBranded<this, T>;
21
21
  parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
22
22
  safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): parse.ZodSafeParseResult<core.output<this>>;
@@ -8,7 +8,7 @@ export interface ZodMiniType<out Output = unknown, out Input = unknown> extends
8
8
  clone(def?: this["_zod"]["def"], params?: {
9
9
  parent: boolean;
10
10
  }): this;
11
- register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$ZodRegistry<R["_meta"], this>["_meta"]?] : [core.$ZodRegistry<R["_meta"], this>["_meta"]] : ["Incompatible schema"]): this;
11
+ register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R["_schema"] ? undefined extends R["_meta"] ? [core.$replace<R["_meta"], this>?] : [core.$replace<R["_meta"], this>] : ["Incompatible schema"]): this;
12
12
  brand<T extends PropertyKey = PropertyKey>(value?: T): PropertyKey extends T ? this : this & Record<"_zod", Record<"~output", core.output<this> & core.$brand<T>>>;
13
13
  def: this["_zod"]["def"];
14
14
  parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.25.24",
3
+ "version": "3.25.26",
4
4
  "type": "module",
5
5
  "author": "Colin McDonnell <zod@colinhacks.com>",
6
6
  "description": "TypeScript-first schema declaration and validation library with static type inference",