10 mismatches found
In the code
(not documented in code surface - z.instanceof is not listed as an exported function in the provided snippets)
In the docs
You can use `z.instanceof` to check that the input is an instance of a class.
The docs document `z.instanceof()` as a top-level API, but the provided code surface does not include any `_instanceof` function or export. This could be a case where the API is missing from the code surface extract (perhaps it's defined elsewhere), or it's genuinely absent. If absent, documentation is misleading.
Suggested fix
Verify `z.instanceof` exists in the codebase; if it does, ensure it's exported and documented. If not, remove or replace the documentation with the appropriate API.
02Deprecated `message` parameter in Params is not documented as deprecated
packages/zod/src/v4/core/api.ts
mediumIn the code
/** @deprecated This parameter is deprecated. Use `error` instead. */ message?: string | undefined; // supported in Zod 3
In the docs
In the refinements section, the docs use `message` parameter without mentioning it is deprecated.
The code marks the `message` parameter as deprecated in the `Params` type, but the documentation for `.refine()` and other methods still shows using `message` as a valid option without any deprecation warning. Developers following the docs might continue using `message` not knowing it's deprecated.
Suggested fix
Update the docs to note that `message` is deprecated and recommend using `error` instead.
03z.nativeEnum() is documented as a valid API but is deprecated/removed in code
packages/zod/src/v4/core/api.ts
mediumIn the code
export function _nativeEnum<T extends util.EnumLike>(Class: util.SchemaClass<schemas.$ZodEnum>, entries: T, params?: string | $ZodEnumParams): schemas.$ZodEnum<T>
In the docs
Use `z.enum()` for externally declared TypeScript enums. The `z.nativeEnum()` API is deprecated.
The docs still mention `z.nativeEnum()` as a deprecated API, but the code still exports it as `_nativeEnum`. However, the docs say it is deprecated and recommend using `z.enum()` instead, but the code does not mark it as deprecated. A developer might be confused whether to use it or not.
Suggested fix
Either remove the deprecation notice from the docs or mark `_nativeEnum` as deprecated in the code. If deprecated, provide migration guidance to `z.enum()`.
In the code
(not documented in code surface - no _httpUrl or _hostname functions in the provided API surface)
In the docs
z.httpUrl(); // http or https URLs only
z.hostname();
The docs list `z.httpUrl()` and `z.hostname()` as string format validators, but the provided code surface does not include any such functions. They might be defined elsewhere (not in the excerpt) or removed. If removed, the docs are outdated.
Suggested fix
Either add these functions to the code or remove them from the documentation. If they exist, confirm they are exported.
05z.uuid() version options may not match code: docs mention 'v1' through 'v8', code only defines uuidv4, uuidv6, uuidv7
packages/zod/src/v4/core/api.ts
mediumIn the code
export function _uuidv4, _uuidv6, _uuidv7 (but no generic _uuid with version param in the provided surface)
In the docs
z.uuid({ version: "v4" }); // supports "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8"
The docs claim `z.uuid()` accepts a `version` parameter supporting v1 through v8, but the code surface only shows `_uuid`, `_uuidv4`, `_uuidv6`, `_uuidv7` functions. The generic `z.uuid()` function exists but its signature doesn't show a `version` parameter in the provided excerpt. It might be hidden in the class definitions, but if not, the docs are misleading.
Suggested fix
Ensure `z.uuid()` supports the `version` parameter as documented; if not, adjust the docs to only list the supported versions.
06z.stringbool() documentation does not mention the 'case' parameter default is 'insensitive'
packages/zod/src/v4/core/api.ts
lowIn the code
case?: "sensitive" | "insensitive" | undefined; // @default `"insensitive"`
In the docs
By default the schema is _case-insensitive_; all inputs are converted to lowercase before comparison to the `truthy`/`falsy` values.
The code explicitly documents the default value of `case` as `"insensitive"`, but the docs only mention it in prose. This is minor but could be clearer.
Suggested fix
Explicitly state in the docs that `case` defaults to `"insensitive"`.
07z.literal() array input is documented but the code signature supports an array of literals
packages/zod/src/v4/core/api.ts
lowIn the code
function _literal<const T extends Array<util.Literal>>(Class, value: T, params?): schemas.$ZodLiteral<T[number]>
In the docs
z.literal(["red", "green", "blue"]);
The code supports passing an array of literals to `z.literal()`, and the docs show this usage. However, the docs also show `z.literal("tuna")` and `z.literal(12)` which are also supported. No mismatch here, but the array overload may be underdocumented (the docs do include it). This is likely a low-severity observation.
Suggested fix
No change needed; docs match code.
08z.enum() deprecation note about z.nativeEnum() is contradicted by code not marking it deprecated
packages/zod/src/v4/core/api.ts
lowIn the code
function _nativeEnum<T extends util.EnumLike>(Class: util.SchemaClass<schemas.$ZodEnum>, entries: T, params?: string | $ZodEnumParams): schemas.$ZodEnum<T>
In the docs
The `z.nativeEnum()` API is deprecated.
The code does not mark `_nativeEnum` as deprecated, but the docs explicitly say it is deprecated. This inconsistency may confuse developers on whether to use it.
Suggested fix
Either update the code to mark `_nativeEnum` as deprecated or remove the deprecation note from the docs.
In the code
(not documented in code surface - no _hash function in the provided API surface)
In the docs
z.hash("sha256"); // or "sha1", "sha384", "sha512", "md5"
The docs document `z.hash()` as a string format validator, but the provided code surface does not include any `_hash` function or similar. This could be a missing export or a removed feature.
Suggested fix
Verify `z.hash` exists; if it does, ensure it's exported. If not, remove or replace documentation.
10z.iso.datetime() precision parameter documentation may contradict code's TimePrecision constant
packages/zod/src/v4/core/api.ts
lowIn the code
export const TimePrecision
In the docs
z.iso.datetime({ precision: -1 }); // minute precision (no seconds)
The docs describe `precision` parameter values like -1, 0, 3 for datetime. The code exports a `TimePrecision` constant but its values are not shown. There could be a mismatch in allowed precision values.
Suggested fix
Ensure the documented precision values match the `TimePrecision` type/constant in the code.