@@ -7,7 +7,33 @@ Parses URLSearchParams to JavaScript objects according to Zod schemas.
77
88## Description
99
10- TODO
10+ ### Allowed Zod Schemas
11+
12+ - The top-level schema must be an ` z.object() ` or ` z.union() ` of ` z.object() ` .
13+ - Properties may be a ` z.object() ` or ` z.union() ` of objects.
14+ - All union object types must flatten to a parseable object schema with non-conflicting property types
15+ - Primitive properties must be a ` z.string() ` , ` z.number() ` , ` z.boolean() ` or ` z.date() ` .
16+ - The primitives ` z.bigint() ` and ` z.symbol() ` are not supported.
17+ - Strings with zero length are not allowed.
18+ If not specified, a ` z.string() ` is always assumed to be ` z.string().min(1) ` .
19+ - Using ` z.enum() ` is allowed and equivalent to ` z.string() ` .
20+ - Any property may be ` z.optional() ` or ` z.never() ` .
21+ - No property may ` z.void() ` , ` z.undefined() ` , ` z.any() ` , or ` z.unknown() ` .
22+ - Any property may be ` z.nullable() ` except ` z.array() ` .
23+ - A ` z.array() ` must be of a single value-type.
24+ - The value-types must obey all the same basic rules
25+ for primitive object, union, and property types.
26+ - Value-types may not be ` z.nullable() ` or ` z.undefined() ` .
27+ - The value-type cannot contain a nested ` z.array() ` type at any level.
28+ - A ` z.record() ` has less-strict schema constraints but weaker parsing guarantees:
29+ - They keys must be ` z.string() ` .
30+ - The value-type may be a single primitive type.
31+ - The value-type may be ` z.nullable() ` .
32+ - The value-type may be a union of primitives.
33+ This union must include ` z.string() `
34+ and all values will be parsed as ` z.string() ` .
35+ - The value-type may not be a ` z.record() ` , ` z.array() ` , or ` z.object() ` .
36+ - Properties that are ` z.literal() ` allowed and must still obey these rules.
1137
1238## Installation
1339
0 commit comments