docsParity
colinhacks/zod43,025TypeScript

vs https://zod.dev/

The documentation provides comprehensive coverage of Zod's public API with good examples, but there are notable gaps around recent additions (Zod 4.0+ features like template literals, stringbool, codecs) and some inconsistencies with the actual function signatures in the code. Most critically, several newly exported functions and types from the api.ts file are either undocumented or their documentation is sparse.

5 high3 medium2 low
Open issue with all findings ↗
12
Files analyzed
267
API symbols
3
Doc pages
46.9s
Analyzed in
9%
API coverage: Poorly documented
23 of 267 exported symbols mentioned in docs
4 deprecated APIs detected in code
  • $ZodCUIDParamspackages/zod/src/v4/core/api.ts
  • $ZodCheckCUIDParamspackages/zod/src/v4/core/api.ts
  • _cuidpackages/zod/src/v4/core/api.ts
  • _nativeEnumpackages/zod/src/v4/core/api.ts
12 source files inspected · claude-haiku-4-5-20251001 · Jun 21, 2026

10 mismatches found

01

Deprecated parameter 'message' in Params type not warned in docs

packages/zod/src/v4/core/api.ts

high
In the code
/** @deprecated This parameter is deprecated. Use `error` instead. */ message?: string | undefined; // supported in Zod 3
In the docs
(not documented)

The code marks the `message` parameter as @deprecated in favor of `error` in the Params type definition, but the documentation never warns users about this deprecation or provides migration guidance. Developers using the old `message` parameter will not be informed to switch to `error`.

Suggested fix
Add a deprecation notice in the API documentation explaining that the `message` parameter is deprecated and should be replaced with `error`. Include an example of the migration.
02

Missing z.httpUrl() in code but documented

packages/zod/src/v4/core/api.ts

high
In the code
(not documented)
In the docs
z.httpUrl();       // http or https URLs only

The documentation references z.httpUrl() as a built-in string format validator, but this function does not appear in the exported API surface. The docs show it as a convenience method, but it's not exposed as a public export.

Suggested fix
Either: (1) add z.httpUrl() as an exported function in the public API, or (2) remove z.httpUrl() from the documentation and replace the example with the documented alternative: z.url({ protocol: /^https?$/, hostname: z.regexes.domain })
03

Missing z.hostname() in code but documented

packages/zod/src/v4/core/api.ts

high
In the code
(not documented)
In the docs
z.hostname();

The documentation lists z.hostname() as a string format validator, but this function does not appear in the exported API surface from the code.

Suggested fix
Either add z.hostname() as an exported function or remove it from the documentation and provide an alternative approach if needed.
04

Missing z.hex() in code but documented

packages/zod/src/v4/core/api.ts

high
In the code
(not documented)
In the docs
z.hex();

The documentation lists z.hex() as a string format validator, but this function does not appear in the exported API surface from the code.

Suggested fix
Either add z.hex() as an exported function or remove it from the documentation.
05

Missing z.hash() in code but documented

packages/zod/src/v4/core/api.ts

high
In the code
(not documented)
In the docs
z.hash("sha256");  // or "sha1", "sha384", "sha512", "md5"

The documentation lists z.hash() as a string format validator with multiple algorithms, but this function does not appear in the exported API surface from the code.

Suggested fix
Either add z.hash() as an exported function or remove it from the documentation.
06

Missing documentation for z.stringFormat() function

packages/zod/src/v4/core/api.ts

medium
In the code
export function _stringFormat<Format extends string>(Class: typeof schemas.$ZodCustomStringFormat, format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params: string | $ZodStringFormatParams = {}): schemas.$ZodCustomStringFormat<Format>  // L1802
In the docs
(not documented)

The code exports a _stringFormat function for creating custom string formats, but this is not documented in the API reference. Developers looking to create custom string formats beyond the built-in ones would have no guidance.

Suggested fix
Add a section in the 'Custom formats' part of the documentation explaining _stringFormat with an example: `z.stringFormat("cool-id", /^cool-[a-z0-9]{95}$/)` maps to the internal _stringFormat function.
07

z.nativeEnum() deprecated but docs suggest alternatives unclearly

packages/zod/src/v4/core/api.ts

medium
In the code
export function _nativeEnum<T extends util.EnumLike>(Class: util.SchemaClass<schemas.$ZodEnum>, entries: T, params?: string | $ZodEnumParams): schemas.$ZodEnum<T>  // L1384
In the docs
Use `z.enum()` for externally declared TypeScript enums. The `z.nativeEnum()` API is deprecated.

The docs say z.nativeEnum() is deprecated and suggest using z.enum() instead, but the code still exports _nativeEnum without a @deprecated marker visible in the API surface. The migration path is stated but lacks detail.

Suggested fix
Add @deprecated markers to _nativeEnum in the code and provide a concrete migration example in the docs showing how to convert z.nativeEnum(MyEnum) to z.enum(MyEnum).
08

z.promise() marked deprecated in docs but status unclear

packages/zod/src/v4/core/api.ts

medium
In the code
(not documented as deprecated in code surface provided)
In the docs
**Deprecated** — `z.promise()` is deprecated. There are vanishingly few valid uses cases for a `Promise` schema. If you suspect a value might be a `Promise`, simply `await` it before parsing it with Zod.

The documentation clearly marks z.promise() as deprecated and explains why, which is good. However, the code surface doesn't show a @deprecated marker on the _promise function (L1586), so it's unclear if the code actually marks it as deprecated. The documentation should align with code markers.

Suggested fix
Verify that the _promise function in the code is marked with @deprecated and ensure the docs and code both reflect this status consistently.
09

Missing documentation for _isoDuration function

packages/zod/src/v4/core/api.ts

low
In the code
export function _isoDuration<T extends schemas.$ZodISODuration>(Class: util.SchemaClass<T>, params?: string | $ZodISODurationParams | $ZodCheckISODurationParams): T  // L564
In the docs
z.iso.duration();

The documentation shows z.iso.duration() but provides no examples or explanation of what format is expected. The code exports _isoDuration but the docs lack detail on ISO 8601 duration format validation.

Suggested fix
Add examples and documentation for z.iso.duration() showing valid ISO 8601 duration formats (e.g., 'PT1H', 'P1D', 'P1Y2M3DT4H5M6S').
10

UUID variant methods (z.uuidv4, z.uuidv6, z.uuidv7) not clearly documented

packages/zod/src/v4/core/api.ts

low
In the code
export function _uuidv4<T extends schemas.$ZodUUID>(Class: util.SchemaClass<T>, params?: string | $ZodUUIDv4Params | $ZodCheckUUIDv4Params): T  // L147
export function _uuidv6<T extends schemas.$ZodUUID>(Class: util.SchemaClass<T>, params?: string | $ZodUUIDv6Params | $ZodCheckUUIDv6Params): T  // L165
export function _uuidv7<T extends schemas.$ZodUUID>(Class: util.SchemaClass<T>, params?: string | $ZodUUIDv7Params | $ZodCheckUUIDv7Params): T  // L183
In the docs
// supports "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8"
z.uuid({ version: "v4" });

// for convenience
z.uuidv4();
z.uuidv6();
z.uuidv7();

The code exports _uuidv4, _uuidv6, and _uuidv7 functions, and the docs mention z.uuidv4(), z.uuidv6(), z.uuidv7() as convenience methods. However, the docs do not mention z.uuid({ version: "v8" }) support, yet the code comment says it supports "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8". The supported versions list in docs is incomplete.

Suggested fix
Update the documentation to clarify all supported UUID versions: v1, v2, v3, v4, v5, v6, v7, v8. Add an example for z.uuid({ version: "v8" }) if v8 is supported.