Repository navigation
dhi v1.6.0
Zod 4 core compatibility, one runtime-agnostic core, and Windows wheels.
Zod 4 core internals (#76)
Every dhi schema now exposes Zod 4's internals (_zod.def, _zod.run, optin/optout,
values, the JSON-Schema hook) and is assignable to Zod's $ZodType at the type level.
Libraries that detect Zod 4 schemas and call Zod's own core helpers work unchanged:
@modelcontextprotocol/sdkregisterTool/registerPrompt— object schemas, raw shapes
and output schemas.tools/listno longer fails withdef.shape is not a function.z.toJSONSchema(dhiSchema),z.safeParse(dhiSchema, …),instanceof z.ZodObject.
Single runtime-agnostic core
dhi, dhi/edge, dhi/cloudflare and dhi/nextjs now re-export the same core: identical
behaviour and JIT everywhere, no WASM instantiation, no top-level await, no bundler
configuration. The edge and Next.js entries had drifted ~800 lines behind the Node entry.
Behavioural parity with Zod 4
A new differential test (tests/test-zod-parity.ts) runs 250+ schemas over 4,400+ inputs
against the real zod package and requires identical accept/reject decisions and identical
parsed output. Closing the gaps it found changed, among others:
- String formats:
uuidchecks RFC 9562 version/variant nibbles,urlaccepts any
WHATWG-parsable URL,ipv6/cidrv6use the WHATWG parser,base64/base64urlpadding
rules, leap-year-awaredate, ISO 8601-1duration, Zod'semailrules. .lowercase()/.uppercase()validate case (.toLowerCase()/.toUpperCase()transform).z.number()rejectsInfinity;.int()means safe integer; float-safe.multipleOf().- Objects: absent optional keys stay absent,
.catchall()validates unknown keys, JSON Schema
requiredfollows Zod'soptin/optoutrule withio: 'input' | 'output'honoured. - Tuples allow omitting trailing optional items; enum-keyed records are exhaustive
(z.partialRecordfor optional keys);z.coerce.date()coerces any input.
Also added
- Zod 4 standalone checks for
.check(...):z.minLength,z.gt/gte/lt/lte,
z.multipleOf,z.regex,z.refine,z.superRefineand the rest of the set. z.uuidv4/v6/v7,z.xid,z.ksuid,z.hash(),z.httpUrl(),z.hostname(),z.hex(),
z.stringbool(),z.iso.datetime(),z.mac(),z.jwt()..nonoptional()and.exactOptional()as real wrappers.z.enum([...])infers the literal union instead of widening tostring.dhi/schema-nextjsexport alias.
Python
Windows wheels (AMD64, CPython 3.9–3.14 including free-threaded) are now built and
published; the C extension compiles under MSVC. (#59)