Documentation
¶
Index ¶
- Variables
- type BigIntegerConstraint
- type BoolConstraint
- type Complex64Constraint
- type Complex128Constraint
- type ComplexConstraint
- type EmailConstraint
- type Float32Constraint
- type Float64Constraint
- type FloatConstraint
- type FunctionConstraint
- type FunctionParams
- type IntegerConstraint
- type IsoConstraint
- type IsoDatetimeOptions
- type IsoTimeOptions
- type JWTOptions
- type LazyConstraint
- type NetworkConstraint
- type NeverConstraint
- type NilConstraint
- type ObjectMode
- type StringBoolConstraint
- type StringBoolOptions
- type StringConstraint
- type TimeConstraint
- type URLOptions
- type ZodAny
- func (z *ZodAny[T, R]) CloneFrom(source any)
- func (z *ZodAny[T, R]) Default(v T) *ZodAny[T, R]
- func (z *ZodAny[T, R]) DefaultFunc(fn func() T) *ZodAny[T, R]
- func (z *ZodAny[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodAny[T, R]) IsNilable() bool
- func (z *ZodAny[T, R]) IsOptional() bool
- func (z *ZodAny[T, R]) Meta(meta core.GlobalMeta) *ZodAny[T, R]
- func (z *ZodAny[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodAny[T, R]) Nilable() *ZodAny[T, *T]
- func (z *ZodAny[T, R]) NonOptional() *ZodAny[T, T]
- func (z *ZodAny[T, R]) Nullish() *ZodAny[T, *T]
- func (z *ZodAny[T, R]) Optional() *ZodAny[T, *T]
- func (z *ZodAny[T, R]) Overwrite(transform func(T) T, params ...any) *ZodAny[T, R]
- func (z *ZodAny[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodAny[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodAny[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodAny[T, R]) Prefault(v T) *ZodAny[T, R]
- func (z *ZodAny[T, R]) PrefaultFunc(fn func() T) *ZodAny[T, R]
- func (z *ZodAny[T, R]) Refine(fn func(R) bool, args ...any) *ZodAny[T, R]
- func (z *ZodAny[T, R]) RefineAny(fn func(any) bool, args ...any) *ZodAny[T, R]
- func (z *ZodAny[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
- func (z *ZodAny[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodAnyDef
- type ZodAnyInternals
- type ZodArray
- func (z *ZodArray[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodArray[T, R]
- func (z *ZodArray[T, R]) CloneFrom(source any)
- func (z *ZodArray[T, R]) Default(v T) *ZodArray[T, R]
- func (z *ZodArray[T, R]) DefaultFunc(fn func() T) *ZodArray[T, R]
- func (z *ZodArray[T, R]) Element(index int) any
- func (z *ZodArray[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodArray[T, R]) IsNilable() bool
- func (z *ZodArray[T, R]) IsOptional() bool
- func (z *ZodArray[T, R]) Items() []any
- func (z *ZodArray[T, R]) Length(exactLen int, args ...any) *ZodArray[T, R]
- func (z *ZodArray[T, R]) Max(maxLen int, args ...any) *ZodArray[T, R]
- func (z *ZodArray[T, R]) Meta(meta core.GlobalMeta) *ZodArray[T, R]
- func (z *ZodArray[T, R]) Min(minLen int, args ...any) *ZodArray[T, R]
- func (z *ZodArray[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodArray[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodArray[T, R]) Nilable() *ZodArray[T, *T]
- func (z *ZodArray[T, R]) NonEmpty(args ...any) *ZodArray[T, R]
- func (z *ZodArray[T, R]) NonOptional() *ZodArray[T, T]
- func (z *ZodArray[T, R]) Nullish() *ZodArray[T, *T]
- func (z *ZodArray[T, R]) Optional() *ZodArray[T, *T]
- func (z *ZodArray[T, R]) Overwrite(transform func(R) R, params ...any) *ZodArray[T, R]
- func (z *ZodArray[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodArray[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodArray[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodArray[T, R]) Prefault(v T) *ZodArray[T, R]
- func (z *ZodArray[T, R]) PrefaultFunc(fn func() T) *ZodArray[T, R]
- func (z *ZodArray[T, R]) Refine(fn func(R) bool, params ...any) *ZodArray[T, R]
- func (z *ZodArray[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodArray[T, R]
- func (z *ZodArray[T, R]) Rest() any
- func (z *ZodArray[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodArray[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodArrayDef
- type ZodArrayInternals
- type ZodBase64
- type ZodBase64URL
- type ZodBigInt
- func (z *ZodBigInt[T]) CloneFrom(source any)
- func (z *ZodBigInt[T]) Coerce(input any) (any, bool)
- func (z *ZodBigInt[T]) Default(v *big.Int) *ZodBigInt[T]
- func (z *ZodBigInt[T]) DefaultFunc(fn func() *big.Int) *ZodBigInt[T]
- func (z *ZodBigInt[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodBigInt[T]) Gt(value *big.Int, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Gte(value *big.Int, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) IsNilable() bool
- func (z *ZodBigInt[T]) IsOptional() bool
- func (z *ZodBigInt[T]) Lt(value *big.Int, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Lte(value *big.Int, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Max(maximum *big.Int, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Meta(meta core.GlobalMeta) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Min(minimum *big.Int, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) MultipleOf(value *big.Int, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodBigInt[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodBigInt[T]) Negative(params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Nilable() *ZodBigInt[**big.Int]
- func (z *ZodBigInt[T]) NonNegative(params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) NonOptional() *ZodBigInt[*big.Int]
- func (z *ZodBigInt[T]) NonPositive(params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Nullish() *ZodBigInt[**big.Int]
- func (z *ZodBigInt[T]) Optional() *ZodBigInt[**big.Int]
- func (z *ZodBigInt[T]) Overwrite(transform func(T) T, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodBigInt[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodBigInt[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodBigInt[T]) Positive(params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Prefault(v *big.Int) *ZodBigInt[T]
- func (z *ZodBigInt[T]) PrefaultFunc(fn func() *big.Int) *ZodBigInt[T]
- func (z *ZodBigInt[T]) Refine(fn func(T) bool, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) RefineAny(fn func(any) bool, params ...any) *ZodBigInt[T]
- func (z *ZodBigInt[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodBigInt[T]) Transform(fn func(*big.Int, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodBigIntDef
- type ZodBigIntInternals
- type ZodBool
- func (z *ZodBool[T]) Check(fn func(value T, payload *core.ParsePayload), params ...any) *ZodBool[T]
- func (z *ZodBool[T]) CloneFrom(source any)
- func (z *ZodBool[T]) Coerce(input any) (any, bool)
- func (z *ZodBool[T]) Default(v bool) *ZodBool[T]
- func (z *ZodBool[T]) DefaultFunc(fn func() bool) *ZodBool[T]
- func (z *ZodBool[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodBool[T]) IsNilable() bool
- func (z *ZodBool[T]) IsOptional() bool
- func (z *ZodBool[T]) Meta(meta core.GlobalMeta) *ZodBool[T]
- func (z *ZodBool[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodBool[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodBool[T]) Nilable() *ZodBool[*bool]
- func (z *ZodBool[T]) NonOptional() *ZodBool[bool]
- func (z *ZodBool[T]) Nullish() *ZodBool[*bool]
- func (z *ZodBool[T]) Optional() *ZodBool[*bool]
- func (z *ZodBool[T]) Overwrite(transform func(T) T, params ...any) *ZodBool[T]
- func (z *ZodBool[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodBool[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodBool[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodBool[T]) Prefault(v bool) *ZodBool[T]
- func (z *ZodBool[T]) PrefaultFunc(fn func() bool) *ZodBool[T]
- func (z *ZodBool[T]) Refine(fn func(T) bool, params ...any) *ZodBool[T]
- func (z *ZodBool[T]) RefineAny(fn func(any) bool, params ...any) *ZodBool[T]
- func (z *ZodBool[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodBool[T]) Transform(fn func(bool, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodBoolDef
- type ZodBoolInternals
- type ZodCIDRv4
- func (z *ZodCIDRv4[T]) CloneFrom(source any)
- func (z *ZodCIDRv4[T]) Coerce(input any) (any, bool)
- func (z *ZodCIDRv4[T]) Default(v string) *ZodCIDRv4[T]
- func (z *ZodCIDRv4[T]) DefaultFunc(fn func() string) *ZodCIDRv4[T]
- func (z *ZodCIDRv4[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodCIDRv4[T]) IsNilable() bool
- func (z *ZodCIDRv4[T]) IsOptional() bool
- func (z *ZodCIDRv4[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodCIDRv4[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodCIDRv4[T]) Nilable() *ZodCIDRv4[*string]
- func (z *ZodCIDRv4[T]) Nullish() *ZodCIDRv4[*string]
- func (z *ZodCIDRv4[T]) Optional() *ZodCIDRv4[*string]
- func (z *ZodCIDRv4[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodCIDRv4[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodCIDRv4[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodCIDRv4[T]) Prefault(v string) *ZodCIDRv4[T]
- func (z *ZodCIDRv4[T]) PrefaultFunc(fn func() string) *ZodCIDRv4[T]
- func (z *ZodCIDRv4[T]) Refine(fn func(T) bool, params ...any) *ZodCIDRv4[T]
- func (z *ZodCIDRv4[T]) RefineAny(fn func(any) bool, params ...any) *ZodCIDRv4[T]
- func (z *ZodCIDRv4[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodCIDRv4[T]) Transform(fn func(string, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodCIDRv4Def
- type ZodCIDRv4Internals
- type ZodCIDRv6
- func (z *ZodCIDRv6[T]) CloneFrom(source any)
- func (z *ZodCIDRv6[T]) Coerce(input any) (any, bool)
- func (z *ZodCIDRv6[T]) Default(v string) *ZodCIDRv6[T]
- func (z *ZodCIDRv6[T]) DefaultFunc(fn func() string) *ZodCIDRv6[T]
- func (z *ZodCIDRv6[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodCIDRv6[T]) IsNilable() bool
- func (z *ZodCIDRv6[T]) IsOptional() bool
- func (z *ZodCIDRv6[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodCIDRv6[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodCIDRv6[T]) Nilable() *ZodCIDRv6[*string]
- func (z *ZodCIDRv6[T]) Nullish() *ZodCIDRv6[*string]
- func (z *ZodCIDRv6[T]) Optional() *ZodCIDRv6[*string]
- func (z *ZodCIDRv6[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodCIDRv6[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodCIDRv6[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodCIDRv6[T]) Prefault(v string) *ZodCIDRv6[T]
- func (z *ZodCIDRv6[T]) PrefaultFunc(fn func() string) *ZodCIDRv6[T]
- func (z *ZodCIDRv6[T]) Refine(fn func(T) bool, params ...any) *ZodCIDRv6[T]
- func (z *ZodCIDRv6[T]) RefineAny(fn func(any) bool, params ...any) *ZodCIDRv6[T]
- func (z *ZodCIDRv6[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodCIDRv6[T]) Transform(fn func(string, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodCIDRv6Def
- type ZodCIDRv6Internals
- type ZodCUID
- type ZodCUID2
- type ZodComplex
- func CoercedComplex(params ...any) *ZodComplex[complex128]
- func CoercedComplex64(params ...any) *ZodComplex[complex64]
- func CoercedComplex64Ptr(params ...any) *ZodComplex[*complex64]
- func CoercedComplex128(params ...any) *ZodComplex[complex128]
- func CoercedComplex128Ptr(params ...any) *ZodComplex[*complex128]
- func CoercedComplexPtr(params ...any) *ZodComplex[*complex128]
- func Complex(params ...any) *ZodComplex[complex128]
- func Complex64(params ...any) *ZodComplex[complex64]
- func Complex64Ptr(params ...any) *ZodComplex[*complex64]
- func Complex128(params ...any) *ZodComplex[complex128]
- func Complex128Ptr(params ...any) *ZodComplex[*complex128]
- func ComplexPtr(params ...any) *ZodComplex[*complex128]
- func ComplexTyped[T ComplexConstraint](params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) CloneFrom(source any)
- func (z *ZodComplex[T]) Coerce(input any) (any, bool)
- func (z *ZodComplex[T]) Default(v complex128) *ZodComplex[T]
- func (z *ZodComplex[T]) DefaultFunc(fn func() complex128) *ZodComplex[T]
- func (z *ZodComplex[T]) Finite(params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodComplex[T]) Gt(value float64, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) Gte(value float64, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) IsNilable() bool
- func (z *ZodComplex[T]) IsOptional() bool
- func (z *ZodComplex[T]) Lt(value float64, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) Lte(value float64, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) Max(maximum float64, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) Meta(meta core.GlobalMeta) *ZodComplex[T]
- func (z *ZodComplex[T]) Min(minimum float64, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodComplex[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodComplex[T]) Negative(params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) Nilable() *ZodComplex[*complex128]
- func (z *ZodComplex[T]) NonNegative(params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) NonPositive(params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) Nullish() *ZodComplex[*complex128]
- func (z *ZodComplex[T]) Optional() *ZodComplex[*complex128]
- func (z *ZodComplex[T]) Overwrite(transform func(T) T, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodComplex[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodComplex[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodComplex[T]) Positive(params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) Prefault(v complex128) *ZodComplex[T]
- func (z *ZodComplex[T]) PrefaultFunc(fn func() complex128) *ZodComplex[T]
- func (z *ZodComplex[T]) Refine(fn func(T) bool, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) RefineAny(fn func(any) bool, params ...any) *ZodComplex[T]
- func (z *ZodComplex[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodComplex[T]) Transform(fn func(complex128, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodComplexDef
- type ZodComplexInternals
- type ZodDiscriminatedUnion
- func DiscriminatedUnion(discriminator string, options []any, args ...any) *ZodDiscriminatedUnion[any, any]
- func DiscriminatedUnionPtr(discriminator string, options []any, args ...any) *ZodDiscriminatedUnion[any, *any]
- func DiscriminatedUnionTyped[T any, R any](discriminator string, options []any, args ...any) *ZodDiscriminatedUnion[T, R]
- func (z *ZodDiscriminatedUnion[T, R]) CloneFrom(source any)
- func (z *ZodDiscriminatedUnion[T, R]) Default(v T) *ZodDiscriminatedUnion[T, R]
- func (z *ZodDiscriminatedUnion[T, R]) DefaultFunc(fn func() T) *ZodDiscriminatedUnion[T, R]
- func (z *ZodDiscriminatedUnion[T, R]) Discriminator() string
- func (z *ZodDiscriminatedUnion[T, R]) DiscriminatorMap() map[any]core.ZodSchema
- func (z *ZodDiscriminatedUnion[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodDiscriminatedUnion[T, R]) IsNilable() bool
- func (z *ZodDiscriminatedUnion[T, R]) IsOptional() bool
- func (z *ZodDiscriminatedUnion[T, R]) Meta(meta core.GlobalMeta) *ZodDiscriminatedUnion[T, R]
- func (z *ZodDiscriminatedUnion[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodDiscriminatedUnion[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodDiscriminatedUnion[T, R]) Nilable() *ZodDiscriminatedUnion[T, *T]
- func (z *ZodDiscriminatedUnion[T, R]) Nullish() *ZodDiscriminatedUnion[T, *T]
- func (z *ZodDiscriminatedUnion[T, R]) Optional() *ZodDiscriminatedUnion[T, *T]
- func (z *ZodDiscriminatedUnion[T, R]) Options() []core.ZodSchema
- func (z *ZodDiscriminatedUnion[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodDiscriminatedUnion[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodDiscriminatedUnion[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodDiscriminatedUnion[T, R]) Prefault(v T) *ZodDiscriminatedUnion[T, R]
- func (z *ZodDiscriminatedUnion[T, R]) PrefaultFunc(fn func() T) *ZodDiscriminatedUnion[T, R]
- func (z *ZodDiscriminatedUnion[T, R]) Refine(fn func(R) bool, params ...any) *ZodDiscriminatedUnion[T, R]
- func (z *ZodDiscriminatedUnion[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodDiscriminatedUnion[T, R]
- func (z *ZodDiscriminatedUnion[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodDiscriminatedUnion[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodDiscriminatedUnionDef
- type ZodDiscriminatedUnionInternals
- type ZodEmail
- func (z *ZodEmail[T]) Browser(params ...any) *ZodEmail[T]
- func (z *ZodEmail[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodEmail[T]) Html5(params ...any) *ZodEmail[T]
- func (z *ZodEmail[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodEmail[T]) Nilable() *ZodEmail[*string]
- func (z *ZodEmail[T]) Nullish() *ZodEmail[*string]
- func (z *ZodEmail[T]) Optional() *ZodEmail[*string]
- func (z *ZodEmail[T]) Rfc5322(params ...any) *ZodEmail[T]
- func (z *ZodEmail[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodEmail[T]) Unicode(params ...any) *ZodEmail[T]
- type ZodEmoji
- type ZodEnum
- func Enum[T comparable](values ...T) *ZodEnum[T, T]
- func EnumMap[T comparable](entries map[string]T, params ...any) *ZodEnum[T, T]
- func EnumMapPtr[T comparable](entries map[string]T, params ...any) *ZodEnum[T, *T]
- func EnumMapTyped[T comparable, R any](entries map[string]T, args ...any) *ZodEnum[T, R]
- func EnumPtr[T comparable](values ...T) *ZodEnum[T, *T]
- func EnumSlice[T comparable](values []T) *ZodEnum[T, T]
- func EnumSlicePtr[T comparable](values []T) *ZodEnum[T, *T]
- func (z *ZodEnum[T, R]) CloneFrom(source any)
- func (z *ZodEnum[T, R]) Default(v T) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) DefaultFunc(fn func() T) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) Enum() map[string]T
- func (z *ZodEnum[T, R]) Exclude(keys []string, params ...any) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) Extract(keys []string, params ...any) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodEnum[T, R]) IsNilable() bool
- func (z *ZodEnum[T, R]) IsOptional() bool
- func (z *ZodEnum[T, R]) Meta(meta core.GlobalMeta) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodEnum[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
- func (z *ZodEnum[T, R]) Nilable() *ZodEnum[T, *T]
- func (z *ZodEnum[T, R]) Nullish() *ZodEnum[T, *T]
- func (z *ZodEnum[T, R]) Optional() *ZodEnum[T, *T]
- func (z *ZodEnum[T, R]) Options() []T
- func (z *ZodEnum[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodEnum[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodEnum[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodEnum[T, R]) Prefault(v T) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) PrefaultFunc(fn func() T) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) Refine(fn func(R) bool, params ...any) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodEnum[T, R]
- func (z *ZodEnum[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
- func (z *ZodEnum[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodEnumDef
- type ZodEnumInternals
- type ZodFile
- func (z *ZodFile[T, R]) CloneFrom(source any)
- func (z *ZodFile[T, R]) Default(v T) *ZodFile[T, R]
- func (z *ZodFile[T, R]) DefaultFunc(fn func() T) *ZodFile[T, R]
- func (z *ZodFile[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodFile[T, R]) IsNilable() bool
- func (z *ZodFile[T, R]) IsOptional() bool
- func (z *ZodFile[T, R]) Max(maximum int64, params ...any) *ZodFile[T, R]
- func (z *ZodFile[T, R]) Meta(meta core.GlobalMeta) *ZodFile[T, R]
- func (z *ZodFile[T, R]) Mime(mimeTypes []string, params ...any) *ZodFile[T, R]
- func (z *ZodFile[T, R]) Min(minimum int64, params ...any) *ZodFile[T, R]
- func (z *ZodFile[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodFile[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodFile[T, R]) Nilable() *ZodFile[T, *T]
- func (z *ZodFile[T, R]) Nullish() *ZodFile[T, *T]
- func (z *ZodFile[T, R]) Optional() *ZodFile[T, *T]
- func (z *ZodFile[T, R]) Overwrite(transform func(R) R, params ...any) *ZodFile[T, R]
- func (z *ZodFile[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodFile[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodFile[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodFile[T, R]) Prefault(v T) *ZodFile[T, R]
- func (z *ZodFile[T, R]) PrefaultFunc(fn func() T) *ZodFile[T, R]
- func (z *ZodFile[T, R]) Refine(fn func(R) bool, params ...any) *ZodFile[T, R]
- func (z *ZodFile[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodFile[T, R]
- func (z *ZodFile[T, R]) Size(expected int64, params ...any) *ZodFile[T, R]
- func (z *ZodFile[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodFile[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodFileDef
- type ZodFileInternals
- type ZodFloat
- type ZodFloatDef
- type ZodFloatInternals
- type ZodFloatTyped
- func CoercedFloat[T FloatConstraint](params ...any) *ZodFloatTyped[T, T]
- func CoercedFloat32(params ...any) *ZodFloatTyped[float32, float32]
- func CoercedFloat32Ptr(params ...any) *ZodFloatTyped[float32, *float32]
- func CoercedFloat64(params ...any) *ZodFloatTyped[float64, float64]
- func CoercedFloat64Ptr(params ...any) *ZodFloatTyped[float64, *float64]
- func CoercedFloatPtr(params ...any) *ZodFloatTyped[float64, *float64]
- func CoercedNumber(params ...any) *ZodFloatTyped[float64, float64]
- func CoercedNumberPtr(params ...any) *ZodFloatTyped[float64, *float64]
- func Float(params ...any) *ZodFloatTyped[float64, float64]
- func Float32(params ...any) *ZodFloatTyped[float32, float32]
- func Float32Ptr(params ...any) *ZodFloatTyped[float32, *float32]
- func Float64(params ...any) *ZodFloatTyped[float64, float64]
- func Float64Ptr(params ...any) *ZodFloatTyped[float64, *float64]
- func FloatPtr(params ...any) *ZodFloatTyped[float64, *float64]
- func FloatTyped[T FloatConstraint](params ...any) *ZodFloatTyped[T, T]
- func Number(params ...any) *ZodFloatTyped[float64, float64]
- func NumberPtr(params ...any) *ZodFloatTyped[float64, *float64]
- func (z *ZodFloatTyped[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) CloneFrom(source any)
- func (z *ZodFloatTyped[T, R]) Coerce(input any) (any, bool)
- func (z *ZodFloatTyped[T, R]) Default(v float64) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) DefaultFunc(fn func() float64) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Finite(params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodFloatTyped[T, R]) Gt(value float64, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Gte(value float64, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Int(params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) IsNilable() bool
- func (z *ZodFloatTyped[T, R]) IsOptional() bool
- func (z *ZodFloatTyped[T, R]) Lt(value float64, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Lte(value float64, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Max(maximum float64, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Meta(meta core.GlobalMeta) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Min(minimum float64, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) MultipleOf(value float64, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodFloatTyped[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
- func (z *ZodFloatTyped[T, R]) Negative(params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Nilable() *ZodFloatTyped[T, *T]
- func (z *ZodFloatTyped[T, R]) NonNegative(params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) NonOptional() *ZodFloatTyped[T, T]
- func (z *ZodFloatTyped[T, R]) NonPositive(params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Nullish() *ZodFloatTyped[T, *T]
- func (z *ZodFloatTyped[T, R]) Optional() *ZodFloatTyped[T, *T]
- func (z *ZodFloatTyped[T, R]) Overwrite(transform func(T) T, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodFloatTyped[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodFloatTyped[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodFloatTyped[T, R]) Positive(params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Prefault(v float64) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) PrefaultFunc(fn func() float64) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Refine(fn func(T) bool, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Safe(params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) Step(step float64, params ...any) *ZodFloatTyped[T, R]
- func (z *ZodFloatTyped[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
- func (z *ZodFloatTyped[T, R]) Transform(fn func(float64, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodFunction
- func (z *ZodFunction[T]) CloneFrom(source any)
- func (z *ZodFunction[T]) Default(v any) *ZodFunction[T]
- func (z *ZodFunction[T]) DefaultFunc(fn func() any) *ZodFunction[T]
- func (z *ZodFunction[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodFunction[T]) Implement(fn any) (any, error)
- func (z *ZodFunction[T]) Input(inputSchema core.ZodType[any]) *ZodFunction[T]
- func (z *ZodFunction[T]) IsNilable() bool
- func (z *ZodFunction[T]) IsOptional() bool
- func (z *ZodFunction[T]) Meta(meta core.GlobalMeta) *ZodFunction[T]
- func (z *ZodFunction[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodFunction[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodFunction[T]) Nilable() *ZodFunction[*any]
- func (z *ZodFunction[T]) Nullish() *ZodFunction[*any]
- func (z *ZodFunction[T]) Optional() *ZodFunction[*any]
- func (z *ZodFunction[T]) Output(outputSchema core.ZodType[any]) *ZodFunction[T]
- func (z *ZodFunction[T]) Overwrite(transform func(T) T, params ...any) *ZodFunction[T]
- func (z *ZodFunction[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodFunction[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodFunction[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodFunction[T]) Prefault(v any) *ZodFunction[T]
- func (z *ZodFunction[T]) PrefaultFunc(fn func() any) *ZodFunction[T]
- func (z *ZodFunction[T]) Refine(fn func(T) bool, params ...any) *ZodFunction[T]
- func (z *ZodFunction[T]) RefineAny(fn func(any) bool, params ...any) *ZodFunction[T]
- func (z *ZodFunction[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodFunction[T]) Transform(fn func(any, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodFunctionDef
- type ZodFunctionInternals
- type ZodIPv4
- func (z *ZodIPv4[T]) CloneFrom(source any)
- func (z *ZodIPv4[T]) Coerce(input any) (any, bool)
- func (z *ZodIPv4[T]) Default(v string) *ZodIPv4[T]
- func (z *ZodIPv4[T]) DefaultFunc(fn func() string) *ZodIPv4[T]
- func (z *ZodIPv4[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodIPv4[T]) IsNilable() bool
- func (z *ZodIPv4[T]) IsOptional() bool
- func (z *ZodIPv4[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodIPv4[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodIPv4[T]) Nilable() *ZodIPv4[*string]
- func (z *ZodIPv4[T]) Nullish() *ZodIPv4[*string]
- func (z *ZodIPv4[T]) Optional() *ZodIPv4[*string]
- func (z *ZodIPv4[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodIPv4[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodIPv4[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodIPv4[T]) Prefault(v string) *ZodIPv4[T]
- func (z *ZodIPv4[T]) PrefaultFunc(fn func() string) *ZodIPv4[T]
- func (z *ZodIPv4[T]) Refine(fn func(T) bool, params ...any) *ZodIPv4[T]
- func (z *ZodIPv4[T]) RefineAny(fn func(any) bool, params ...any) *ZodIPv4[T]
- func (z *ZodIPv4[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodIPv4[T]) Transform(fn func(string, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodIPv4Def
- type ZodIPv4Internals
- type ZodIPv6
- func (z *ZodIPv6[T]) CloneFrom(source any)
- func (z *ZodIPv6[T]) Coerce(input any) (any, bool)
- func (z *ZodIPv6[T]) Default(v string) *ZodIPv6[T]
- func (z *ZodIPv6[T]) DefaultFunc(fn func() string) *ZodIPv6[T]
- func (z *ZodIPv6[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodIPv6[T]) IsNilable() bool
- func (z *ZodIPv6[T]) IsOptional() bool
- func (z *ZodIPv6[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodIPv6[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodIPv6[T]) Nilable() *ZodIPv6[*string]
- func (z *ZodIPv6[T]) Nullish() *ZodIPv6[*string]
- func (z *ZodIPv6[T]) Optional() *ZodIPv6[*string]
- func (z *ZodIPv6[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodIPv6[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodIPv6[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodIPv6[T]) Prefault(v string) *ZodIPv6[T]
- func (z *ZodIPv6[T]) PrefaultFunc(fn func() string) *ZodIPv6[T]
- func (z *ZodIPv6[T]) Refine(fn func(T) bool, params ...any) *ZodIPv6[T]
- func (z *ZodIPv6[T]) RefineAny(fn func(any) bool, params ...any) *ZodIPv6[T]
- func (z *ZodIPv6[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodIPv6[T]) Transform(fn func(string, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodIPv6Def
- type ZodIPv6Internals
- type ZodInteger
- type ZodIntegerDef
- type ZodIntegerInternals
- type ZodIntegerTyped
- func Byte(params ...any) *ZodIntegerTyped[uint8, uint8]
- func BytePtr(params ...any) *ZodIntegerTyped[uint8, *uint8]
- func CoercedInt(params ...any) *ZodIntegerTyped[int, int]
- func CoercedInt8(params ...any) *ZodIntegerTyped[int8, int8]
- func CoercedInt8Ptr(params ...any) *ZodIntegerTyped[int8, *int8]
- func CoercedInt16(params ...any) *ZodIntegerTyped[int16, int16]
- func CoercedInt16Ptr(params ...any) *ZodIntegerTyped[int16, *int16]
- func CoercedInt32(params ...any) *ZodIntegerTyped[int32, int32]
- func CoercedInt32Ptr(params ...any) *ZodIntegerTyped[int32, *int32]
- func CoercedInt64(params ...any) *ZodIntegerTyped[int64, int64]
- func CoercedInt64Ptr(params ...any) *ZodIntegerTyped[int64, *int64]
- func CoercedIntPtr(params ...any) *ZodIntegerTyped[int, *int]
- func CoercedInteger(params ...any) *ZodIntegerTyped[int64, int64]
- func CoercedIntegerPtr(params ...any) *ZodIntegerTyped[int64, *int64]
- func CoercedUint(params ...any) *ZodIntegerTyped[uint, uint]
- func CoercedUint8(params ...any) *ZodIntegerTyped[uint8, uint8]
- func CoercedUint8Ptr(params ...any) *ZodIntegerTyped[uint8, *uint8]
- func CoercedUint16(params ...any) *ZodIntegerTyped[uint16, uint16]
- func CoercedUint16Ptr(params ...any) *ZodIntegerTyped[uint16, *uint16]
- func CoercedUint32(params ...any) *ZodIntegerTyped[uint32, uint32]
- func CoercedUint32Ptr(params ...any) *ZodIntegerTyped[uint32, *uint32]
- func CoercedUint64(params ...any) *ZodIntegerTyped[uint64, uint64]
- func CoercedUint64Ptr(params ...any) *ZodIntegerTyped[uint64, *uint64]
- func CoercedUintPtr(params ...any) *ZodIntegerTyped[uint, *uint]
- func Int(params ...any) *ZodIntegerTyped[int, int]
- func Int8(params ...any) *ZodIntegerTyped[int8, int8]
- func Int8Ptr(params ...any) *ZodIntegerTyped[int8, *int8]
- func Int16(params ...any) *ZodIntegerTyped[int16, int16]
- func Int16Ptr(params ...any) *ZodIntegerTyped[int16, *int16]
- func Int32(params ...any) *ZodIntegerTyped[int32, int32]
- func Int32Ptr(params ...any) *ZodIntegerTyped[int32, *int32]
- func Int64(params ...any) *ZodIntegerTyped[int64, int64]
- func Int64Ptr(params ...any) *ZodIntegerTyped[int64, *int64]
- func IntPtr(params ...any) *ZodIntegerTyped[int, *int]
- func IntegerTyped[T IntegerConstraint](params ...any) *ZodIntegerTyped[T, T]
- func Rune(params ...any) *ZodIntegerTyped[int32, int32]
- func RunePtr(params ...any) *ZodIntegerTyped[int32, *int32]
- func Uint(params ...any) *ZodIntegerTyped[uint, uint]
- func Uint8(params ...any) *ZodIntegerTyped[uint8, uint8]
- func Uint8Ptr(params ...any) *ZodIntegerTyped[uint8, *uint8]
- func Uint16(params ...any) *ZodIntegerTyped[uint16, uint16]
- func Uint16Ptr(params ...any) *ZodIntegerTyped[uint16, *uint16]
- func Uint32(params ...any) *ZodIntegerTyped[uint32, uint32]
- func Uint32Ptr(params ...any) *ZodIntegerTyped[uint32, *uint32]
- func Uint64(params ...any) *ZodIntegerTyped[uint64, uint64]
- func Uint64Ptr(params ...any) *ZodIntegerTyped[uint64, *uint64]
- func UintPtr(params ...any) *ZodIntegerTyped[uint, *uint]
- func (z *ZodIntegerTyped[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) CloneFrom(source any)
- func (z *ZodIntegerTyped[T, R]) Coerce(input any) (any, bool)
- func (z *ZodIntegerTyped[T, R]) Default(v int64) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) DefaultFunc(fn func() int64) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodIntegerTyped[T, R]) Gt(value int64, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Gte(value int64, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) IsNilable() bool
- func (z *ZodIntegerTyped[T, R]) IsOptional() bool
- func (z *ZodIntegerTyped[T, R]) Lt(value int64, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Lte(value int64, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Max(maximum int64, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Meta(meta core.GlobalMeta) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Min(minimum int64, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) MultipleOf(value int64, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodIntegerTyped[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
- func (z *ZodIntegerTyped[T, R]) Negative(params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Nilable() *ZodIntegerTyped[T, *T]
- func (z *ZodIntegerTyped[T, R]) NonNegative(params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) NonOptional() *ZodIntegerTyped[T, T]
- func (z *ZodIntegerTyped[T, R]) NonPositive(params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Nullish() *ZodIntegerTyped[T, *T]
- func (z *ZodIntegerTyped[T, R]) Optional() *ZodIntegerTyped[T, *T]
- func (z *ZodIntegerTyped[T, R]) Overwrite(transform func(T) T, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodIntegerTyped[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodIntegerTyped[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodIntegerTyped[T, R]) Positive(params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Prefault(v int64) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) PrefaultFunc(fn func() R) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Refine(fn func(T) bool, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Safe(params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) Step(step int64, params ...any) *ZodIntegerTyped[T, R]
- func (z *ZodIntegerTyped[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
- func (z *ZodIntegerTyped[T, R]) Transform(fn func(int64, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodIntersection
- func (z *ZodIntersection[T, R]) CloneFrom(source any)
- func (z *ZodIntersection[T, R]) Default(v T) *ZodIntersection[T, R]
- func (z *ZodIntersection[T, R]) DefaultFunc(fn func() T) *ZodIntersection[T, R]
- func (z *ZodIntersection[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodIntersection[T, R]) IsNilable() bool
- func (z *ZodIntersection[T, R]) IsOptional() bool
- func (z *ZodIntersection[T, R]) Left() core.ZodSchema
- func (z *ZodIntersection[T, R]) Meta(meta core.GlobalMeta) *ZodIntersection[T, R]
- func (z *ZodIntersection[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodIntersection[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodIntersection[T, R]) Nilable() *ZodIntersection[T, *T]
- func (z *ZodIntersection[T, R]) NonOptional() *ZodIntersection[T, T]
- func (z *ZodIntersection[T, R]) Nullish() *ZodIntersection[T, *T]
- func (z *ZodIntersection[T, R]) Optional() *ZodIntersection[T, *T]
- func (z *ZodIntersection[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodIntersection[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodIntersection[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodIntersection[T, R]) Prefault(v T) *ZodIntersection[T, R]
- func (z *ZodIntersection[T, R]) PrefaultFunc(fn func() T) *ZodIntersection[T, R]
- func (z *ZodIntersection[T, R]) Refine(fn func(R) bool, params ...any) *ZodIntersection[T, R]
- func (z *ZodIntersection[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodIntersection[T, R]
- func (z *ZodIntersection[T, R]) Right() core.ZodSchema
- func (z *ZodIntersection[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodIntersection[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodIntersectionDef
- type ZodIntersectionInternals
- type ZodIso
- func Iso(params ...any) *ZodIso[string]
- func IsoDate(params ...any) *ZodIso[string]
- func IsoDatePtr(params ...any) *ZodIso[*string]
- func IsoDateTime(params ...any) *ZodIso[string]
- func IsoDateTimePtr(params ...any) *ZodIso[*string]
- func IsoDateTimeTyped[T IsoConstraint](params ...any) *ZodIso[T]
- func IsoDateTyped[T IsoConstraint](params ...any) *ZodIso[T]
- func IsoDuration(params ...any) *ZodIso[string]
- func IsoDurationPtr(params ...any) *ZodIso[*string]
- func IsoDurationTyped[T IsoConstraint](params ...any) *ZodIso[T]
- func IsoPtr(params ...any) *ZodIso[*string]
- func IsoTime(params ...any) *ZodIso[string]
- func IsoTimePtr(params ...any) *ZodIso[*string]
- func IsoTimeTyped[T IsoConstraint](params ...any) *ZodIso[T]
- func IsoTyped[T IsoConstraint](params ...any) *ZodIso[T]
- func (z *ZodIso[T]) Date(params ...any) *ZodIso[T]
- func (z *ZodIso[T]) DateTime(opts ...IsoDatetimeOptions) *ZodIso[T]
- func (z *ZodIso[T]) Default(v string) *ZodIso[T]
- func (z *ZodIso[T]) DefaultFunc(fn func() string) *ZodIso[T]
- func (z *ZodIso[T]) Duration(params ...any) *ZodIso[T]
- func (z *ZodIso[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodIso[T]) Max(maxVal string, params ...any) *ZodIso[T]
- func (z *ZodIso[T]) Min(minVal string, params ...any) *ZodIso[T]
- func (z *ZodIso[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodIso[T]) Nilable() *ZodIso[*string]
- func (z *ZodIso[T]) Nullish() *ZodIso[*string]
- func (z *ZodIso[T]) Optional() *ZodIso[*string]
- func (z *ZodIso[T]) Prefault(v string) *ZodIso[T]
- func (z *ZodIso[T]) PrefaultFunc(fn func() string) *ZodIso[T]
- func (z *ZodIso[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodIso[T]) Time(opts ...IsoTimeOptions) *ZodIso[T]
- type ZodJWT
- type ZodKSUID
- type ZodLazy
- func (z *ZodLazy[T]) CloneFrom(source any)
- func (z *ZodLazy[T]) Coerce(input any) (any, bool)
- func (z *ZodLazy[T]) Default(v any) *ZodLazy[T]
- func (z *ZodLazy[T]) DefaultFunc(fn func() any) *ZodLazy[T]
- func (z *ZodLazy[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodLazy[T]) IsNilable() bool
- func (z *ZodLazy[T]) IsOptional() bool
- func (z *ZodLazy[T]) Meta(meta core.GlobalMeta) *ZodLazy[T]
- func (z *ZodLazy[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodLazy[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodLazy[T]) Nilable() *ZodLazy[*any]
- func (z *ZodLazy[T]) NonOptional() *ZodLazy[any]
- func (z *ZodLazy[T]) Nullish() *ZodLazy[*any]
- func (z *ZodLazy[T]) Optional() *ZodLazy[*any]
- func (z *ZodLazy[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodLazy[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodLazy[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodLazy[T]) Prefault(v any) *ZodLazy[T]
- func (z *ZodLazy[T]) PrefaultFunc(fn func() any) *ZodLazy[T]
- func (z *ZodLazy[T]) Refine(fn func(T) bool, params ...any) *ZodLazy[T]
- func (z *ZodLazy[T]) RefineAny(fn func(any) bool, params ...any) *ZodLazy[T]
- func (z *ZodLazy[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodLazy[T]) Transform(fn func(any, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- func (z *ZodLazy[T]) Unwrap() core.ZodType[any]
- type ZodLazyDef
- type ZodLazyInternals
- type ZodLazyTyped
- func (z *ZodLazyTyped[S]) Default(v any) *ZodLazyTyped[S]
- func (z *ZodLazyTyped[S]) GetInnerSchema() S
- func (z *ZodLazyTyped[S]) MustParse(input any, ctx ...*core.ParseContext) any
- func (z *ZodLazyTyped[S]) Nilable() *ZodLazy[*any]
- func (z *ZodLazyTyped[S]) NonOptional() *ZodLazy[any]
- func (z *ZodLazyTyped[S]) Optional() *ZodLazy[*any]
- func (z *ZodLazyTyped[S]) Parse(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodLazyTyped[S]) Refine(fn func(any) bool, params ...any) *ZodLazyTyped[S]
- type ZodLiteral
- func Literal[T comparable](value T, params ...any) *ZodLiteral[T, T]
- func LiteralOf[T comparable](values []T, params ...any) *ZodLiteral[T, T]
- func LiteralPtr[T comparable](value T, params ...any) *ZodLiteral[T, *T]
- func LiteralPtrOf[T comparable](values []T, params ...any) *ZodLiteral[T, *T]
- func LiteralTyped[T comparable, R any](value T, params ...any) *ZodLiteral[T, R]
- func (z *ZodLiteral[T, R]) Contains(v T) bool
- func (z *ZodLiteral[T, R]) Default(v T) *ZodLiteral[T, R]
- func (z *ZodLiteral[T, R]) DefaultFunc(fn func() T) *ZodLiteral[T, R]
- func (z *ZodLiteral[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodLiteral[T, R]) IsNilable() bool
- func (z *ZodLiteral[T, R]) IsOptional() bool
- func (z *ZodLiteral[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodLiteral[T, R]) MustParseAny(input any, ctx ...*core.ParseContext) any
- func (z *ZodLiteral[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
- func (z *ZodLiteral[T, R]) Nilable() *ZodLiteral[T, *T]
- func (z *ZodLiteral[T, R]) Nullish() *ZodLiteral[T, *T]
- func (z *ZodLiteral[T, R]) Optional() *ZodLiteral[T, *T]
- func (z *ZodLiteral[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodLiteral[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodLiteral[T, R]) Prefault(v T) *ZodLiteral[T, R]
- func (z *ZodLiteral[T, R]) PrefaultFunc(fn func() T) *ZodLiteral[T, R]
- func (z *ZodLiteral[T, R]) Refine(fn func(T) bool, params ...any) *ZodLiteral[T, R]
- func (z *ZodLiteral[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodLiteral[T, R]
- func (z *ZodLiteral[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
- func (z *ZodLiteral[T, R]) Value() T
- func (z *ZodLiteral[T, R]) Values() []T
- type ZodLiteralDef
- type ZodLiteralInternals
- type ZodMap
- func (z *ZodMap[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodMap[T, R]
- func (z *ZodMap[T, R]) CloneFrom(source any)
- func (z *ZodMap[T, R]) Default(v T) *ZodMap[T, R]
- func (z *ZodMap[T, R]) DefaultFunc(fn func() T) *ZodMap[T, R]
- func (z *ZodMap[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodMap[T, R]) IsNilable() bool
- func (z *ZodMap[T, R]) IsOptional() bool
- func (z *ZodMap[T, R]) KeyType() any
- func (z *ZodMap[T, R]) Max(maxLen int, params ...any) *ZodMap[T, R]
- func (z *ZodMap[T, R]) Meta(meta core.GlobalMeta) *ZodMap[T, R]
- func (z *ZodMap[T, R]) Min(minLen int, params ...any) *ZodMap[T, R]
- func (z *ZodMap[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodMap[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodMap[T, R]) Nilable() *ZodMap[T, *T]
- func (z *ZodMap[T, R]) NonOptional() *ZodMap[T, T]
- func (z *ZodMap[T, R]) Nullish() *ZodMap[T, *T]
- func (z *ZodMap[T, R]) Optional() *ZodMap[T, *T]
- func (z *ZodMap[T, R]) Overwrite(transform func(R) R, params ...any) *ZodMap[T, R]
- func (z *ZodMap[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodMap[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodMap[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodMap[T, R]) Prefault(v T) *ZodMap[T, R]
- func (z *ZodMap[T, R]) PrefaultFunc(fn func() T) *ZodMap[T, R]
- func (z *ZodMap[T, R]) Refine(fn func(R) bool, params ...any) *ZodMap[T, R]
- func (z *ZodMap[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodMap[T, R]
- func (z *ZodMap[T, R]) Size(exactLen int, params ...any) *ZodMap[T, R]
- func (z *ZodMap[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodMap[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- func (z *ZodMap[T, R]) ValueType() any
- type ZodMapDef
- type ZodMapInternals
- type ZodNanoID
- type ZodNever
- func (z *ZodNever[T, R]) CloneFrom(source any)
- func (z *ZodNever[T, R]) Default(value T) *ZodNever[T, R]
- func (z *ZodNever[T, R]) DefaultFunc(fn func() T) *ZodNever[T, R]
- func (z *ZodNever[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodNever[T, R]) IsNilable() bool
- func (z *ZodNever[T, R]) IsOptional() bool
- func (z *ZodNever[T, R]) Meta(meta core.GlobalMeta) *ZodNever[T, R]
- func (z *ZodNever[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodNever[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
- func (z *ZodNever[T, R]) Nilable() *ZodNever[T, *T]
- func (z *ZodNever[T, R]) Nullish() *ZodNever[T, *T]
- func (z *ZodNever[T, R]) Optional() *ZodNever[T, *T]
- func (z *ZodNever[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodNever[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodNever[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodNever[T, R]) Prefault(value T) *ZodNever[T, R]
- func (z *ZodNever[T, R]) PrefaultFunc(fn func() T) *ZodNever[T, R]
- func (z *ZodNever[T, R]) Refine(fn func(R) bool, params ...any) *ZodNever[T, R]
- func (z *ZodNever[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodNever[T, R]
- func (z *ZodNever[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
- func (z *ZodNever[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- func (z *ZodNever[T, R]) Unwrap() *ZodNever[T, R]
- type ZodNeverDef
- type ZodNeverInternals
- type ZodNil
- func (z *ZodNil[T]) CloneFrom(source any)
- func (z *ZodNil[T]) Default(v any) *ZodNil[T]
- func (z *ZodNil[T]) DefaultFunc(fn func() any) *ZodNil[T]
- func (z *ZodNil[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodNil[T]) IsNilable() bool
- func (z *ZodNil[T]) IsOptional() bool
- func (z *ZodNil[T]) Meta(meta core.GlobalMeta) *ZodNil[T]
- func (z *ZodNil[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodNil[T]) MustParseAny(input any, ctx ...*core.ParseContext) any
- func (z *ZodNil[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodNil[T]) Nilable() *ZodNil[*any]
- func (z *ZodNil[T]) Nullish() *ZodNil[*any]
- func (z *ZodNil[T]) Optional() *ZodNil[*any]
- func (z *ZodNil[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodNil[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodNil[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodNil[T]) Prefault(v any) *ZodNil[T]
- func (z *ZodNil[T]) PrefaultFunc(fn func() any) *ZodNil[T]
- func (z *ZodNil[T]) Refine(fn func(T) bool, params ...any) *ZodNil[T]
- func (z *ZodNil[T]) RefineAny(fn func(any) bool, params ...any) *ZodNil[T]
- func (z *ZodNil[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodNil[T]) Transform(fn func(any, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodNilDef
- type ZodNilInternals
- type ZodObject
- func LooseObject(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, map[string]any]
- func LooseObjectPtr(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, *map[string]any]
- func Object(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, map[string]any]
- func ObjectPtr(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, *map[string]any]
- func ObjectTyped[T any, R any](shape core.ObjectSchema, params ...any) *ZodObject[T, R]
- func StrictObject(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, map[string]any]
- func StrictObjectPtr(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, *map[string]any]
- func (z *ZodObject[T, R]) Catchall(catchallSchema core.ZodSchema) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) CloneFrom(source any)
- func (z *ZodObject[T, R]) Default(v T) *ZodObject[T, R]
- func (z *ZodObject[T, R]) DefaultFunc(fn func() T) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Extend(augmentation core.ObjectSchema, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) GetCatchall() core.ZodSchema
- func (z *ZodObject[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodObject[T, R]) GetUnknownKeys() ObjectMode
- func (z *ZodObject[T, R]) IsNilable() bool
- func (z *ZodObject[T, R]) IsOptional() bool
- func (z *ZodObject[T, R]) Keyof() *ZodEnum[string, string]
- func (z *ZodObject[T, R]) Max(maxLen int, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Merge(other *ZodObject[T, R], params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Meta(meta core.GlobalMeta) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Min(minLen int, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodObject[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodObject[T, R]) Nilable() *ZodObject[T, *T]
- func (z *ZodObject[T, R]) NonOptional() *ZodObject[T, T]
- func (z *ZodObject[T, R]) Nullish() *ZodObject[T, *T]
- func (z *ZodObject[T, R]) Omit(keys []string, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Optional() *ZodObject[T, *T]
- func (z *ZodObject[T, R]) Overwrite(transform func(R) R, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodObject[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodObject[T, R]) Partial(keys ...[]string) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Passthrough() *ZodObject[T, R]
- func (z *ZodObject[T, R]) Pick(keys []string, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodObject[T, R]) Prefault(v T) *ZodObject[T, R]
- func (z *ZodObject[T, R]) PrefaultFunc(fn func() T) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Properties() core.ObjectSchema
- func (z *ZodObject[T, R]) Property(key string, schema core.ZodSchema, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Refine(fn func(R) bool, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Required(fields ...[]string) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Shape() core.ObjectSchema
- func (z *ZodObject[T, R]) Size(exactLen int, params ...any) *ZodObject[T, R]
- func (z *ZodObject[T, R]) Strict() *ZodObject[T, R]
- func (z *ZodObject[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodObject[T, R]) Strip() *ZodObject[T, R]
- func (z *ZodObject[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodObjectDef
- type ZodObjectInternals
- type ZodRecord
- func PartialRecord(keySchema, valueSchema any, paramArgs ...any) *ZodRecord[map[string]any, map[string]any]
- func PartialRecordPtr(keySchema, valueSchema any, paramArgs ...any) *ZodRecord[map[string]any, *map[string]any]
- func Record(keySchema, valueSchema any, paramArgs ...any) *ZodRecord[map[string]any, map[string]any]
- func RecordPtr(keySchema, valueSchema any, paramArgs ...any) *ZodRecord[map[string]any, *map[string]any]
- func RecordTyped[T any, R any](keySchema, valueSchema any, paramArgs ...any) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) CloneFrom(source any)
- func (z *ZodRecord[T, R]) Default(v T) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) DefaultFunc(fn func() T) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodRecord[T, R]) IsNilable() bool
- func (z *ZodRecord[T, R]) IsOptional() bool
- func (z *ZodRecord[T, R]) KeyType() any
- func (z *ZodRecord[T, R]) Max(maxLen int, params ...any) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) Meta(meta core.GlobalMeta) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) Min(minLen int, params ...any) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodRecord[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodRecord[T, R]) Nilable() *ZodRecord[T, *T]
- func (z *ZodRecord[T, R]) NonOptional() *ZodRecord[T, T]
- func (z *ZodRecord[T, R]) Nullish() *ZodRecord[T, *T]
- func (z *ZodRecord[T, R]) Optional() *ZodRecord[T, *T]
- func (z *ZodRecord[T, R]) Overwrite(transform func(R) R, params ...any) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodRecord[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodRecord[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodRecord[T, R]) Prefault(v T) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) PrefaultFunc(fn func() T) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) Refine(fn func(R) bool, params ...any) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) Size(exactLen int, params ...any) *ZodRecord[T, R]
- func (z *ZodRecord[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodRecord[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- func (z *ZodRecord[T, R]) ValueType() any
- type ZodRecordDef
- type ZodRecordInternals
- type ZodSchemaType
- type ZodSlice
- func (z *ZodSlice[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) CloneFrom(source any)
- func (z *ZodSlice[T, R]) Default(v []T) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) DefaultFunc(fn func() []T) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) Element() any
- func (z *ZodSlice[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodSlice[T, R]) IsNilable() bool
- func (z *ZodSlice[T, R]) IsOptional() bool
- func (z *ZodSlice[T, R]) Length(exactLen int, params ...any) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) Max(maxLen int, params ...any) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) Meta(meta core.GlobalMeta) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) Min(minLen int, params ...any) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodSlice[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodSlice[T, R]) Nilable() *ZodSlice[T, *[]T]
- func (z *ZodSlice[T, R]) NonEmpty(params ...any) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) NonOptional() *ZodSlice[T, []T]
- func (z *ZodSlice[T, R]) Nullish() *ZodSlice[T, *[]T]
- func (z *ZodSlice[T, R]) Optional() *ZodSlice[T, *[]T]
- func (z *ZodSlice[T, R]) Overwrite(transform func(R) R, params ...any) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodSlice[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodSlice[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodSlice[T, R]) Prefault(v []T) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) PrefaultFunc(fn func() []T) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) Refine(fn func(R) bool, params ...any) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodSlice[T, R]
- func (z *ZodSlice[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodSlice[T, R]) Transform(fn func(R, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodSliceDef
- type ZodSliceInternals
- type ZodString
- func (z *ZodString[T]) Check(fn func(value T, payload *core.ParsePayload), params ...any) *ZodString[T]
- func (z *ZodString[T]) CloneFrom(source any)
- func (z *ZodString[T]) Coerce(input any) (any, bool)
- func (z *ZodString[T]) Default(v string) *ZodString[T]
- func (z *ZodString[T]) DefaultFunc(fn func() string) *ZodString[T]
- func (z *ZodString[T]) Email(params ...any) *ZodString[T]
- func (z *ZodString[T]) EndsWith(suffix string, params ...any) *ZodString[T]
- func (z *ZodString[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodString[T]) Includes(substring string, params ...any) *ZodString[T]
- func (z *ZodString[T]) IsNilable() bool
- func (z *ZodString[T]) IsOptional() bool
- func (z *ZodString[T]) JSON(params ...any) *ZodString[T]
- func (z *ZodString[T]) Length(length int, params ...any) *ZodString[T]
- func (z *ZodString[T]) Max(maxLen int, params ...any) *ZodString[T]
- func (z *ZodString[T]) Meta(meta core.GlobalMeta) *ZodString[T]
- func (z *ZodString[T]) Min(minLen int, params ...any) *ZodString[T]
- func (z *ZodString[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodString[T]) MustParseAny(input any, ctx ...*core.ParseContext) any
- func (z *ZodString[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodString[T]) Nilable() *ZodString[*string]
- func (z *ZodString[T]) NonOptional() *ZodString[string]
- func (z *ZodString[T]) Nullish() *ZodString[*string]
- func (z *ZodString[T]) Optional() *ZodString[*string]
- func (z *ZodString[T]) Overwrite(transform func(T) T, params ...any) *ZodString[T]
- func (z *ZodString[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodString[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodString[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodString[T]) Prefault(v string) *ZodString[T]
- func (z *ZodString[T]) PrefaultFunc(fn func() string) *ZodString[T]
- func (z *ZodString[T]) Refine(fn func(T) bool, params ...any) *ZodString[T]
- func (z *ZodString[T]) RefineAny(fn func(any) bool, params ...any) *ZodString[T]
- func (z *ZodString[T]) Regex(pattern *regexp.Regexp, params ...any) *ZodString[T]
- func (z *ZodString[T]) RegexString(pattern string, params ...any) *ZodString[T]
- func (z *ZodString[T]) StartsWith(prefix string, params ...any) *ZodString[T]
- func (z *ZodString[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodString[T]) ToLowerCase(params ...any) *ZodString[T]
- func (z *ZodString[T]) ToUpperCase(params ...any) *ZodString[T]
- func (z *ZodString[T]) Transform(fn func(string, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- func (z *ZodString[T]) Trim(params ...any) *ZodString[T]
- type ZodStringBool
- func CoercedStringBool(params ...any) *ZodStringBool[bool]
- func CoercedStringBoolPtr(params ...any) *ZodStringBool[*bool]
- func StringBool(params ...any) *ZodStringBool[bool]
- func StringBoolPtr(params ...any) *ZodStringBool[*bool]
- func StringBoolTyped[T StringBoolConstraint](params ...any) *ZodStringBool[T]
- func (z *ZodStringBool[T]) CloneFrom(source any)
- func (z *ZodStringBool[T]) Coerce(input any) (any, bool)
- func (z *ZodStringBool[T]) Default(v bool) *ZodStringBool[T]
- func (z *ZodStringBool[T]) DefaultFunc(fn func() bool) *ZodStringBool[T]
- func (z *ZodStringBool[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodStringBool[T]) IsNilable() bool
- func (z *ZodStringBool[T]) IsOptional() bool
- func (z *ZodStringBool[T]) Meta(meta core.GlobalMeta) *ZodStringBool[T]
- func (z *ZodStringBool[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodStringBool[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodStringBool[T]) Nilable() *ZodStringBool[*bool]
- func (z *ZodStringBool[T]) Nullish() *ZodStringBool[*bool]
- func (z *ZodStringBool[T]) Optional() *ZodStringBool[*bool]
- func (z *ZodStringBool[T]) Overwrite(transform func(T) T, params ...any) *ZodStringBool[T]
- func (z *ZodStringBool[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodStringBool[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodStringBool[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodStringBool[T]) Prefault(v string) *ZodStringBool[T]
- func (z *ZodStringBool[T]) PrefaultFunc(fn func() string) *ZodStringBool[T]
- func (z *ZodStringBool[T]) Refine(fn func(T) bool, params ...any) *ZodStringBool[T]
- func (z *ZodStringBool[T]) RefineAny(fn func(any) bool, params ...any) *ZodStringBool[T]
- func (z *ZodStringBool[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodStringBool[T]) Transform(fn func(bool, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodStringBoolDef
- type ZodStringBoolInternals
- type ZodStringDef
- type ZodStringInternals
- type ZodStruct
- func (z *ZodStruct[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) CloneFrom(source any)
- func (z *ZodStruct[T, R]) Default(v T) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) DefaultFunc(fn func() T) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) Extend(augmentation core.StructSchema, params ...any) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) GetCatchall() core.ZodSchema
- func (z *ZodStruct[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodStruct[T, R]) GetUnknownKeys() string
- func (z *ZodStruct[T, R]) IsNilable() bool
- func (z *ZodStruct[T, R]) IsOptional() bool
- func (z *ZodStruct[T, R]) Meta(meta core.GlobalMeta) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodStruct[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodStruct[T, R]) Nilable() *ZodStruct[T, *T]
- func (z *ZodStruct[T, R]) NonOptional() *ZodStruct[T, T]
- func (z *ZodStruct[T, R]) Nullish() *ZodStruct[T, *T]
- func (z *ZodStruct[T, R]) Optional() *ZodStruct[T, *T]
- func (z *ZodStruct[T, R]) Overwrite(transform func(R) R, params ...any) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodStruct[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodStruct[T, R]) Partial(keys ...[]string) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodStruct[T, R]) Prefault(v T) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) PrefaultFunc(fn func() T) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) Refine(fn func(R) bool, params ...any) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) Required(fields ...[]string) *ZodStruct[T, R]
- func (z *ZodStruct[T, R]) Shape() core.StructSchema
- func (z *ZodStruct[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodStruct[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodStructDef
- type ZodStructInternals
- type ZodTime
- func (z *ZodTime[T]) CloneFrom(source any)
- func (z *ZodTime[T]) Coerce(input any) (any, bool)
- func (z *ZodTime[T]) Default(v time.Time) *ZodTime[T]
- func (z *ZodTime[T]) DefaultFunc(fn func() time.Time) *ZodTime[T]
- func (z *ZodTime[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodTime[T]) IsNilable() bool
- func (z *ZodTime[T]) IsOptional() bool
- func (z *ZodTime[T]) Meta(meta core.GlobalMeta) *ZodTime[T]
- func (z *ZodTime[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodTime[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodTime[T]) Nilable() *ZodTime[*time.Time]
- func (z *ZodTime[T]) Nullish() *ZodTime[*time.Time]
- func (z *ZodTime[T]) Optional() *ZodTime[*time.Time]
- func (z *ZodTime[T]) Overwrite(transform func(T) T, params ...any) *ZodTime[T]
- func (z *ZodTime[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodTime[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodTime[T]) Pipe(target core.ZodType[any]) *core.ZodPipe[T, any]
- func (z *ZodTime[T]) Prefault(v time.Time) *ZodTime[T]
- func (z *ZodTime[T]) PrefaultFunc(fn func() time.Time) *ZodTime[T]
- func (z *ZodTime[T]) Refine(fn func(T) bool, params ...any) *ZodTime[T]
- func (z *ZodTime[T]) RefineAny(fn func(any) bool, params ...any) *ZodTime[T]
- func (z *ZodTime[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- func (z *ZodTime[T]) Transform(fn func(time.Time, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
- type ZodTimeDef
- type ZodTimeInternals
- type ZodTransform
- func (z *ZodTransform[In, Out]) GetInner() core.ZodSchema
- func (z *ZodTransform[In, Out]) GetInternals() *core.ZodTypeInternals
- func (z *ZodTransform[In, Out]) MustStrictParse(input Out, ctx ...*core.ParseContext) Out
- func (z *ZodTransform[In, Out]) Parse(input any) (any, error)
- func (z *ZodTransform[In, Out]) StrictParse(input Out, ctx ...*core.ParseContext) (Out, error)
- func (z *ZodTransform[In, Out]) Type() core.ZodTypeCode
- type ZodTransformDef
- type ZodTransformInternals
- type ZodULID
- type ZodURL
- func (z *ZodURL[T]) CloneFrom(source any)
- func (z *ZodURL[T]) Coerce(input any) (any, bool)
- func (z *ZodURL[T]) Default(v string) *ZodURL[T]
- func (z *ZodURL[T]) DefaultFunc(fn func() string) *ZodURL[T]
- func (z *ZodURL[T]) GetInternals() *core.ZodTypeInternals
- func (z *ZodURL[T]) IsNilable() bool
- func (z *ZodURL[T]) IsOptional() bool
- func (z *ZodURL[T]) MustParse(input any, ctx ...*core.ParseContext) T
- func (z *ZodURL[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
- func (z *ZodURL[T]) Nilable() *ZodURL[*string]
- func (z *ZodURL[T]) Nullish() *ZodURL[*string]
- func (z *ZodURL[T]) Optional() *ZodURL[*string]
- func (z *ZodURL[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
- func (z *ZodURL[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodURL[T]) Prefault(v string) *ZodURL[T]
- func (z *ZodURL[T]) PrefaultFunc(fn func() string) *ZodURL[T]
- func (z *ZodURL[T]) Refine(fn func(T) bool, params ...any) *ZodURL[T]
- func (z *ZodURL[T]) RefineAny(fn func(any) bool, params ...any) *ZodURL[T]
- func (z *ZodURL[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
- type ZodURLDef
- type ZodURLInternals
- type ZodUUID
- func Uuid(params ...any) *ZodUUID[string]
- func UuidPtr(params ...any) *ZodUUID[*string]
- func Uuidv4(params ...any) *ZodUUID[string]
- func Uuidv4Ptr(params ...any) *ZodUUID[*string]
- func Uuidv6(params ...any) *ZodUUID[string]
- func Uuidv6Ptr(params ...any) *ZodUUID[*string]
- func Uuidv7(params ...any) *ZodUUID[string]
- func Uuidv7Ptr(params ...any) *ZodUUID[*string]
- type ZodUnion
- func (z *ZodUnion[T, R]) CloneFrom(source any)
- func (z *ZodUnion[T, R]) Default(v T) *ZodUnion[T, R]
- func (z *ZodUnion[T, R]) DefaultFunc(fn func() T) *ZodUnion[T, R]
- func (z *ZodUnion[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodUnion[T, R]) IsNilable() bool
- func (z *ZodUnion[T, R]) IsOptional() bool
- func (z *ZodUnion[T, R]) Meta(meta core.GlobalMeta) *ZodUnion[T, R]
- func (z *ZodUnion[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodUnion[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
- func (z *ZodUnion[T, R]) Nilable() *ZodUnion[T, *T]
- func (z *ZodUnion[T, R]) NonOptional() *ZodUnion[T, T]
- func (z *ZodUnion[T, R]) Nullish() *ZodUnion[T, *T]
- func (z *ZodUnion[T, R]) Optional() *ZodUnion[T, *T]
- func (z *ZodUnion[T, R]) Options() []core.ZodSchema
- func (z *ZodUnion[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodUnion[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodUnion[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodUnion[T, R]) Prefault(v T) *ZodUnion[T, R]
- func (z *ZodUnion[T, R]) PrefaultFunc(fn func() T) *ZodUnion[T, R]
- func (z *ZodUnion[T, R]) Refine(fn func(R) bool, params ...any) *ZodUnion[T, R]
- func (z *ZodUnion[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodUnion[T, R]
- func (z *ZodUnion[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
- func (z *ZodUnion[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodUnionDef
- type ZodUnionInternals
- type ZodUnknown
- func (z *ZodUnknown[T, R]) CloneFrom(source any)
- func (z *ZodUnknown[T, R]) Default(v T) *ZodUnknown[T, R]
- func (z *ZodUnknown[T, R]) DefaultFunc(fn func() T) *ZodUnknown[T, R]
- func (z *ZodUnknown[T, R]) GetInternals() *core.ZodTypeInternals
- func (z *ZodUnknown[T, R]) IsNilable() bool
- func (z *ZodUnknown[T, R]) IsOptional() bool
- func (z *ZodUnknown[T, R]) Meta(meta core.GlobalMeta) *ZodUnknown[T, R]
- func (z *ZodUnknown[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
- func (z *ZodUnknown[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
- func (z *ZodUnknown[T, R]) Nilable() *ZodUnknown[T, *T]
- func (z *ZodUnknown[T, R]) NonOptional() *ZodUnknown[T, T]
- func (z *ZodUnknown[T, R]) Nullish() *ZodUnknown[T, *T]
- func (z *ZodUnknown[T, R]) Optional() *ZodUnknown[T, *T]
- func (z *ZodUnknown[T, R]) Overwrite(transform func(T) T, params ...any) *ZodUnknown[T, R]
- func (z *ZodUnknown[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
- func (z *ZodUnknown[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
- func (z *ZodUnknown[T, R]) Pipe(target core.ZodType[any]) *core.ZodPipe[R, any]
- func (z *ZodUnknown[T, R]) Prefault(v T) *ZodUnknown[T, R]
- func (z *ZodUnknown[T, R]) PrefaultFunc(fn func() T) *ZodUnknown[T, R]
- func (z *ZodUnknown[T, R]) Refine(fn func(R) bool, args ...any) *ZodUnknown[T, R]
- func (z *ZodUnknown[T, R]) RefineAny(fn func(any) bool, args ...any) *ZodUnknown[T, R]
- func (z *ZodUnknown[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
- func (z *ZodUnknown[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
- type ZodUnknownDef
- type ZodUnknownInternals
- type ZodXID
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilPointerToArray = errors.New("nil pointer to array") ErrNilPointer = errors.New("nil pointer") ErrExpectedArrayOrSlice = errors.New("expected array or slice") )
Static error variables
var ( ErrSchemaIsNil = errors.New("schema is nil") ErrSchemaInternalsIsNil = errors.New("schema internals is nil") ErrNoDiscriminatorValuesFound = errors.New("no discriminator values found for field") ErrOptionIsNil = errors.New("option is nil") ErrDuplicateDiscriminatorValue = errors.New("duplicate discriminator value") ErrFailedToBuildDiscriminatorMap = errors.New("failed to build discriminator map") ErrNoValidDiscriminatorValues = errors.New("no valid discriminator values found for field") )
Static error variables
var ( PrecisionMinute = func() *int { i := -1; return &i }() PrecisionSecond = func() *int { i := 0; return &i }() PrecisionDecisecond = func() *int { i := 1; return &i }() PrecisionCentisecond = func() *int { i := 2; return &i }() PrecisionMillisecond = func() *int { i := 3; return &i }() PrecisionMicrosecond = func() *int { i := 6; return &i }() PrecisionNanosecond = func() *int { i := 9; return &i }() )
var ( ErrInternalMapType = errors.New("internal error: T is not a map type") ErrInternalMapKeyNotString = errors.New("internal error: map key is not string") ErrInternalCannotConvertValue = errors.New("internal error: cannot convert value type") ErrInternalCannotConvertRecord = errors.New("internal error: cannot convert validated record back to T") ErrNilPointerToRecord = errors.New("nil pointer to record") ErrNonStringKeyInMap = errors.New("non-string key found in map, records require string keys") ErrExpectedMapStringAny = errors.New("expected map[string]any") ErrValueValidationFailed = errors.New("value validation failed for key") )
Static error variables
var ( ErrFieldNotFoundOrNotSettable = errors.New("field not found or not settable") ErrCannotAssignToField = errors.New("cannot assign value to field of type") )
Static error variables
var (
ErrNilPointerCannotConvertToObject = errors.New("nil pointer cannot be converted to object")
)
Static error variables
var (
ErrParseComplexUnexpectedType = errors.New("internal error: ParseComplex returned unexpected type")
)
Static error variables
Functions ¶
This section is empty.
Types ¶
type BigIntegerConstraint ¶ added in v0.3.0
BigIntegerConstraint restricts values to *big.Int or **big.Int.
type BoolConstraint ¶ added in v0.3.0
BoolConstraint restricts values to bool or *bool.
type Complex64Constraint ¶ added in v0.3.0
Complex64Constraint defines constraint for complex64 types
type Complex128Constraint ¶ added in v0.3.0
type Complex128Constraint interface {
complex128 | *complex128
}
Complex128Constraint defines constraint for complex128 types
type ComplexConstraint ¶ added in v0.3.0
type ComplexConstraint interface {
complex64 | complex128 | *complex64 | *complex128
}
ComplexConstraint defines supported complex types for generic implementation
type EmailConstraint ¶ added in v0.3.0
type Float32Constraint ¶ added in v0.3.0
Float32Constraint restricts values to float32 or *float32.
type Float64Constraint ¶ added in v0.3.0
Float64Constraint restricts values to float64 or *float64.
type FloatConstraint ¶ added in v0.3.0
FloatConstraint restricts values to supported float types or their pointers.
type FunctionConstraint ¶ added in v0.3.0
FunctionConstraint restricts values to function or *function.
type FunctionParams ¶
type FunctionParams struct {
Input core.ZodType[any] `json:"input,omitempty"`
Output core.ZodType[any] `json:"output,omitempty"`
}
FunctionParams defines parameters for function schema creation
type IntegerConstraint ¶ added in v0.3.0
type IntegerConstraint interface {
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 |
~*int | ~*int8 | ~*int16 | ~*int32 | ~*int64 | ~*uint | ~*uint8 | ~*uint16 | ~*uint32 | ~*uint64
}
IntegerConstraint restricts values to supported integer types or their pointers.
type IsoConstraint ¶ added in v0.3.0
type IsoDatetimeOptions ¶ added in v0.3.0
type IsoTimeOptions ¶ added in v0.3.0
type IsoTimeOptions struct {
Precision *int // fraction seconds precision (nil = any, -1 minute precision)
}
type JWTOptions ¶ added in v0.3.0
type JWTOptions struct {
// Algorithm specifies the expected signing algorithm
// If empty, any algorithm is accepted (basic structure validation only)
Algorithm string
}
JWTOptions defines options for JWT validation
type LazyConstraint ¶ added in v0.3.0
LazyConstraint restricts values to any or *any for lazy schema types
type NetworkConstraint ¶ added in v0.3.0
NetworkConstraint defines the constraint for network address types (string-based)
type NeverConstraint ¶ added in v0.3.0
type NeverConstraint interface {
any
}
NeverConstraint defines the types that can be used with ZodNever
type NilConstraint ¶ added in v0.3.0
type NilConstraint interface {
any
}
NilConstraint restricts values to any or *any
type ObjectMode ¶
type ObjectMode string
ObjectMode defines how to handle unknown keys in object validation
const ( ObjectModeStrict ObjectMode = "strict" // Reject unknown keys ObjectModeStrip ObjectMode = "strip" // Remove unknown keys ObjectModePassthrough ObjectMode = "passthrough" // Allow unknown keys )
type StringBoolConstraint ¶ added in v0.3.0
StringBoolConstraint restricts values to bool or *bool for StringBool output.
type StringBoolOptions ¶
type StringBoolOptions struct {
Truthy []string // Values that evaluate to true
Falsy []string // Values that evaluate to false
Case string // "sensitive" or "insensitive"
}
StringBoolOptions provides configuration for stringbool schema creation
type StringConstraint ¶ added in v0.3.0
StringConstraint restricts values to string or *string.
type TimeConstraint ¶ added in v0.3.0
TimeConstraint restricts values to time.Time or *time.Time.
type URLOptions ¶ added in v0.3.0
type URLOptions struct {
// Hostname validation pattern
Hostname *regexp.Regexp
// Protocol validation pattern
Protocol *regexp.Regexp
}
URLOptions defines options for URL validation (similar to IsoDatetimeOptions)
type ZodAny ¶
ZodAny represents an any-value validation schema with dual generic parameters T = base type (any), R = constraint type (any or *any)
func AnyPtr ¶ added in v0.3.0
AnyPtr creates any schema that accepts any value - returns pointer constraint
func (*ZodAny[T, R]) DefaultFunc ¶
DefaultFunc preserves current constraint type R
func (*ZodAny[T, R]) GetInternals ¶
func (z *ZodAny[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodAny[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodAny[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodAny[T, R]) Meta ¶ added in v0.3.1
func (z *ZodAny[T, R]) Meta(meta core.GlobalMeta) *ZodAny[T, R]
Meta stores metadata for this any schema.
func (*ZodAny[T, R]) MustParse ¶
func (z *ZodAny[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse is the variant that panics on error
func (*ZodAny[T, R]) NonOptional ¶ added in v0.3.0
NonOptional removes Optional flag and returns base constraint type T.
func (*ZodAny[T, R]) Overwrite ¶ added in v0.3.0
Overwrite applies data transformation while preserving type structure This allows for data cleaning, normalization, and preprocessing operations
func (*ZodAny[T, R]) Parse ¶
func (z *ZodAny[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse returns the input value as-is with modifier support using engine.ParsePrimitive
func (*ZodAny[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodAny[T, R]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodAny[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodAny[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
StrictParse provides type-safe parsing with compile-time guarantees using engine.ParsePrimitiveStrict
func (*ZodAny[T, R]) Transform ¶
func (z *ZodAny[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using the WrapFn pattern.
type ZodAnyDef ¶
type ZodAnyDef struct {
core.ZodTypeDef
}
ZodAnyDef defines the configuration for any value validation
type ZodAnyInternals ¶
type ZodAnyInternals struct {
core.ZodTypeInternals
Def *ZodAnyDef // Schema definition
}
ZodAnyInternals contains any validator internal state
type ZodArray ¶
ZodArray represents a type-safe fixed-length array validation schema with unified constraint T is the base array type ([]any), R is the constraint type ([]any | *[]any)
func Array ¶
Array creates tuple schema with fixed elements Supports the following patterns: Array() - empty tuple Array([]any{String(), Int()}) - fixed length tuple Array([]any{String(), Int()}, Bool()) - tuple with rest parameter
Graceful handling: Non-[]any arguments are converted to single-element array for convenience
func ArrayPtr ¶ added in v0.3.0
ArrayPtr creates pointer-capable tuple schema
Graceful handling: Non-[]any arguments are converted to single-element array for convenience
func ArrayTyped ¶ added in v0.3.0
ArrayTyped is the generic constructor for tuple schemas Supports explicit syntax only: ArrayTyped([]any{schemas...}) - fixed length tuple ArrayTyped([]any{schemas...}, params) - fixed length tuple with custom params ArrayTyped([]any{schemas...}, Rest) - tuple with rest parameter ArrayTyped([]any{schemas...}, Rest, params) - with custom params
func (*ZodArray[T, R]) Check ¶
func (z *ZodArray[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodArray[T, R]
Check adds a custom validation function that can report multiple issues for array schema.
func (*ZodArray[T, R]) DefaultFunc ¶
DefaultFunc keeps the current generic constraint type R.
func (*ZodArray[T, R]) GetInternals ¶
func (z *ZodArray[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodArray[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodArray[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodArray[T, R]) Meta ¶ added in v0.3.1
func (z *ZodArray[T, R]) Meta(meta core.GlobalMeta) *ZodArray[T, R]
Meta stores metadata for this array schema in the global registry.
func (*ZodArray[T, R]) MustParse ¶
func (z *ZodArray[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodArray[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodArray[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodArray[T, R]) Nilable ¶
Nilable always returns *[]any constraint because the value may be nil.
func (*ZodArray[T, R]) NonOptional ¶ added in v0.3.0
NonOptional removes Optional flag and enforces non-nil value constraint (T). This mirrors the behaviour of Optional().NonOptional() in TS Zod, and produces dedicated "expected = nonoptional" error when input is nil.
func (*ZodArray[T, R]) Nullish ¶
Nullish combines optional and nilable modifiers for maximum flexibility
func (*ZodArray[T, R]) Optional ¶
Optional always returns *[]any constraint because the optional value may be nil.
func (*ZodArray[T, R]) Overwrite ¶ added in v0.3.0
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodArray[T, R]) Parse ¶
func (z *ZodArray[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using array-specific parsing logic Parse validates input using array-specific parsing logic with engine.ParseComplex
func (*ZodArray[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodArray[T, R]) Pipe ¶
Pipe creates a pipeline using the WrapFn pattern. Instead of using adapter structures, this creates a target function that handles type conversion.
WrapFn Implementation:
- Create a target function that extracts T from constraint type R
- Apply the target schema to the extracted T
- Return a ZodPipe with the target function
Zero Redundancy:
- No arrayTypeConverter structure needed
- Direct function composition eliminates overhead
- Type-safe extraction from constraint type R to T
Example:
arrayToString := Array([]any{String()}).Pipe(String()) // []any -> string conversion
func (*ZodArray[T, R]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodArray[T, R]) Refine ¶
Refine applies type-safe validation that matches the schema's output type R.
func (*ZodArray[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodArray[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodArray[T, R]) Transform ¶
func (z *ZodArray[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using the WrapFn pattern. Array types implement direct extraction of T values for transformation.
type ZodArrayDef ¶
type ZodArrayDef struct {
core.ZodTypeDef
Items []any // Element schemas for each position (type-erased for flexibility)
Rest any // Rest schema for variadic elements (nil if no rest)
}
ZodArrayDef defines the schema definition for fixed-length array validation
type ZodArrayInternals ¶
type ZodArrayInternals struct {
core.ZodTypeInternals
Def *ZodArrayDef // Schema definition reference
Items []any // Element schemas for runtime validation
Rest any // Rest schema for variadic elements
}
ZodArrayInternals contains the internal state for array schema
type ZodBase64 ¶ added in v0.3.0
type ZodBase64[T StringConstraint] struct{ *ZodString[T] }
ZodBase64 defines a schema for Base64 encoded strings.
func Base64 ¶ added in v0.3.0
Base64 creates a Base64 encoded string validation schema. Supports custom error messages and schema parameters.
Base64()
Base64("custom error message")
Base64(core.SchemaParams{Description: "Base64 string"})
func Base64Ptr ¶ added in v0.3.0
Base64Ptr creates a Base64 encoded string validation schema for a pointer type.
func Base64Typed ¶ added in v0.3.0
func Base64Typed[T StringConstraint](params ...any) *ZodBase64[T]
Base64Typed creates a Base64 encoded string validation schema for a specific type.
func (*ZodBase64[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodBase64[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodBase64[T]) StrictParse ¶ added in v0.4.0
func (z *ZodBase64[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodBase64URL ¶ added in v0.3.0
type ZodBase64URL[T StringConstraint] struct{ *ZodString[T] }
ZodBase64URL defines a schema for Base64URL encoded strings.
func Base64URL ¶ added in v0.3.0
func Base64URL(params ...any) *ZodBase64URL[string]
Base64URL creates a Base64URL encoded string validation schema. Supports custom error messages and schema parameters.
Base64URL()
Base64URL("custom error message")
Base64URL(core.SchemaParams{Description: "Base64URL string"})
func Base64URLPtr ¶ added in v0.3.0
func Base64URLPtr(params ...any) *ZodBase64URL[*string]
Base64URLPtr creates a Base64URL encoded string validation schema for a pointer type.
func Base64URLTyped ¶ added in v0.3.0
func Base64URLTyped[T StringConstraint](params ...any) *ZodBase64URL[T]
Base64URLTyped creates a Base64URL encoded string validation schema for a specific type.
func (*ZodBase64URL[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodBase64URL[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodBase64URL[T]) StrictParse ¶ added in v0.4.0
func (z *ZodBase64URL[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodBigInt ¶
type ZodBigInt[T BigIntegerConstraint] struct { // contains filtered or unexported fields }
ZodBigInt represents a big.Int validation schema with type safety
func BigIntTyped ¶ added in v0.3.0
func BigIntTyped[T BigIntegerConstraint](params ...any) *ZodBigInt[T]
BigIntTyped is the generic constructor for big.Int schemas
func CoercedBigInt ¶ added in v0.2.1
CoercedBigInt creates coerced *big.Int schema
func CoercedBigIntPtr ¶ added in v0.3.0
CoercedBigIntPtr creates coerced **big.Int schema
func (*ZodBigInt[T]) DefaultFunc ¶
DefaultFunc preserves current generic type T
func (*ZodBigInt[T]) GetInternals ¶
func (z *ZodBigInt[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodBigInt[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodBigInt[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodBigInt[T]) Meta ¶ added in v0.3.1
func (z *ZodBigInt[T]) Meta(meta core.GlobalMeta) *ZodBigInt[T]
Meta stores metadata for this bigint schema.
func (*ZodBigInt[T]) MultipleOf ¶
MultipleOf adds multiple of validation
func (*ZodBigInt[T]) MustParse ¶
func (z *ZodBigInt[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse validates the input value and panics on failure
func (*ZodBigInt[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodBigInt[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse provides compile-time type safety and panics on validation failure. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodBigInt[T]) NonNegative ¶
NonNegative adds non-negative number validation (>= 0)
func (*ZodBigInt[T]) NonOptional ¶ added in v0.3.0
NonOptional removes optional flag and returns *big.Int constraint (single pointer). This is useful after Optional()/Nilable() when nil values should be disallowed again.
func (*ZodBigInt[T]) NonPositive ¶
NonPositive adds non-positive number validation (<= 0)
func (*ZodBigInt[T]) Overwrite ¶ added in v0.3.0
Overwrite transforms big.Int value while keeping the same type
func (*ZodBigInt[T]) Parse ¶
func (z *ZodBigInt[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns a value that matches the generic type T with full type safety.
func (*ZodBigInt[T]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodBigInt[T]) PrefaultFunc ¶
PrefaultFunc keeps current generic type T.
func (*ZodBigInt[T]) StrictParse ¶ added in v0.4.0
func (z *ZodBigInt[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodBigIntDef ¶
type ZodBigIntDef struct {
core.ZodTypeDef
}
ZodBigIntDef defines the configuration for big.Int validation
type ZodBigIntInternals ¶
type ZodBigIntInternals struct {
core.ZodTypeInternals
Def *ZodBigIntDef // Schema definition
}
ZodBigIntInternals contains big.Int validator internal state
type ZodBool ¶
type ZodBool[T BoolConstraint] struct { // contains filtered or unexported fields }
ZodBool represents a boolean validation schema with type safety
func Bool ¶
Bool creates a bool schema following Zod TypeScript v4 pattern Usage:
Bool() // no parameters
Bool("custom error") // string shorthand
Bool(SchemaParams{...}) // full parameters
func BoolTyped ¶ added in v0.3.0
func BoolTyped[T BoolConstraint](params ...any) *ZodBool[T]
BoolTyped is the underlying generic function for creating boolean schemas allowing for explicit type parameterization
func CoercedBool ¶ added in v0.2.1
CoercedBool creates a bool schema with coercion enabled
func CoercedBoolPtr ¶ added in v0.3.0
CoercedBoolPtr creates a *bool schema with coercion enabled
func (*ZodBool[T]) Check ¶ added in v0.3.0
func (z *ZodBool[T]) Check(fn func(value T, payload *core.ParsePayload), params ...any) *ZodBool[T]
Check adds a custom validation function that can push multiple issues via ParsePayload.
func (*ZodBool[T]) DefaultFunc ¶
DefaultFunc keeps the current generic type T.
func (*ZodBool[T]) GetInternals ¶
func (z *ZodBool[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodBool[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodBool[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodBool[T]) Meta ¶ added in v0.3.1
func (z *ZodBool[T]) Meta(meta core.GlobalMeta) *ZodBool[T]
Meta stores metadata for this boolean schema in the global registry.
func (*ZodBool[T]) MustParse ¶
func (z *ZodBool[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the type-safe variant that panics on error.
func (*ZodBool[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodBool[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
func (*ZodBool[T]) NonOptional ¶ added in v0.3.0
NonOptional removes the optional flag and forces return type to bool. It also sets internals.Type to ZodTypeNonOptional so that error reporting uses "nonoptional" rather than "bool" when nil is encountered.
func (*ZodBool[T]) Nullish ¶
Nullish combines optional and nilable modifiers for maximum flexibility
func (*ZodBool[T]) Overwrite ¶ added in v0.3.0
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodBool[T]) Parse ¶
func (z *ZodBool[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns a value that matches the generic type T with full type safety.
func (*ZodBool[T]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodBool[T]) Pipe ¶
Pipe creates a pipeline using the WrapFn pattern. Instead of using adapter structures, this creates a target function that handles type conversion.
func (*ZodBool[T]) PrefaultFunc ¶
PrefaultFunc keeps the current generic type T.
func (*ZodBool[T]) Refine ¶
Refine applies a custom validation function that matches the schema's output type T.
func (*ZodBool[T]) StrictParse ¶ added in v0.4.0
func (z *ZodBool[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodBoolDef ¶
type ZodBoolDef struct {
core.ZodTypeDef
}
ZodBoolDef defines the configuration for boolean validation
type ZodBoolInternals ¶
type ZodBoolInternals struct {
core.ZodTypeInternals
Def *ZodBoolDef // Schema definition
}
ZodBoolInternals contains boolean validator internal state
type ZodCIDRv4 ¶
type ZodCIDRv4[T NetworkConstraint] struct { // contains filtered or unexported fields }
ZodCIDRv4 represents a CIDRv4 notation validation schema
func CIDRv4Typed ¶ added in v0.3.0
func CIDRv4Typed[T NetworkConstraint](params ...any) *ZodCIDRv4[T]
CIDRv4Typed is the generic constructor for CIDRv4 notation schemas
func CoercedCIDRv4 ¶ added in v0.3.0
CoercedCIDRv4 creates coerced CIDRv4 schema that attempts string conversion
func (*ZodCIDRv4[T]) Coerce ¶ added in v0.3.0
Coerce implements type conversion interface using coerce package
func (*ZodCIDRv4[T]) DefaultFunc ¶
DefaultFunc preserves current generic type T
func (*ZodCIDRv4[T]) GetInternals ¶
func (z *ZodCIDRv4[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodCIDRv4[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodCIDRv4[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodCIDRv4[T]) MustParse ¶
func (z *ZodCIDRv4[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the variant that panics on error
func (*ZodCIDRv4[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodCIDRv4[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
func (*ZodCIDRv4[T]) Optional ¶
Optional allows nil values, returns pointer type for nullable semantics
func (*ZodCIDRv4[T]) Parse ¶
func (z *ZodCIDRv4[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns type-safe CIDRv4 notation using unified engine API
func (*ZodCIDRv4[T]) ParseAny ¶ added in v0.3.1
ParseAny validates the input and returns any type (for runtime interface)
func (*ZodCIDRv4[T]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodCIDRv4[T]) StrictParse ¶ added in v0.4.0
func (z *ZodCIDRv4[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodCIDRv4Def ¶
type ZodCIDRv4Def struct {
core.ZodTypeDef
}
ZodCIDRv4Def defines the configuration for CIDRv4 notation validation
type ZodCIDRv4Internals ¶
type ZodCIDRv4Internals struct {
core.ZodTypeInternals
Def *ZodCIDRv4Def // Schema definition
}
ZodCIDRv4Internals contains CIDRv4 validator internal state
type ZodCIDRv6 ¶
type ZodCIDRv6[T NetworkConstraint] struct { // contains filtered or unexported fields }
ZodCIDRv6 represents a CIDRv6 notation validation schema
func CIDRv6Typed ¶ added in v0.3.0
func CIDRv6Typed[T NetworkConstraint](params ...any) *ZodCIDRv6[T]
CIDRv6Typed is the generic constructor for CIDRv6 notation schemas
func CoercedCIDRv6 ¶ added in v0.3.0
CoercedCIDRv6 creates coerced CIDRv6 schema that attempts string conversion
func (*ZodCIDRv6[T]) Coerce ¶ added in v0.3.0
Coerce implements type conversion interface using coerce package
func (*ZodCIDRv6[T]) DefaultFunc ¶
DefaultFunc preserves current generic type T
func (*ZodCIDRv6[T]) GetInternals ¶
func (z *ZodCIDRv6[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodCIDRv6[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodCIDRv6[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodCIDRv6[T]) MustParse ¶
func (z *ZodCIDRv6[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the variant that panics on error
func (*ZodCIDRv6[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodCIDRv6[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
func (*ZodCIDRv6[T]) Optional ¶
Optional allows nil values, returns pointer type for nullable semantics
func (*ZodCIDRv6[T]) Parse ¶
func (z *ZodCIDRv6[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns type-safe CIDRv6 notation using unified engine API
func (*ZodCIDRv6[T]) ParseAny ¶ added in v0.3.1
ParseAny validates the input and returns any type (for runtime interface)
func (*ZodCIDRv6[T]) Prefault ¶ added in v0.3.0
Prefault provides fallback values on validation failure
func (*ZodCIDRv6[T]) PrefaultFunc ¶ added in v0.3.0
PrefaultFunc provides dynamic fallback values
func (*ZodCIDRv6[T]) StrictParse ¶ added in v0.4.0
func (z *ZodCIDRv6[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodCIDRv6Def ¶
type ZodCIDRv6Def struct {
core.ZodTypeDef
}
ZodCIDRv6Def defines the configuration for CIDRv6 notation validation
type ZodCIDRv6Internals ¶
type ZodCIDRv6Internals struct {
core.ZodTypeInternals
Def *ZodCIDRv6Def // Schema definition
}
ZodCIDRv6Internals contains CIDRv6 validator internal state
type ZodCUID ¶ added in v0.3.0
type ZodCUID[T StringConstraint] struct{ *ZodString[T] }
func (*ZodCUID[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodCUID[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodCUID[T]) StrictParse ¶ added in v0.4.0
func (z *ZodCUID[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodCUID2 ¶ added in v0.3.0
type ZodCUID2[T StringConstraint] struct{ *ZodString[T] }
func (*ZodCUID2[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodCUID2[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodCUID2[T]) StrictParse ¶ added in v0.4.0
func (z *ZodCUID2[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodComplex ¶
type ZodComplex[T ComplexConstraint] struct { // contains filtered or unexported fields }
ZodComplex represents a generic complex number validation schema
func CoercedComplex ¶ added in v0.3.0
func CoercedComplex(params ...any) *ZodComplex[complex128]
CoercedComplex creates coerced complex128 schema (default)
func CoercedComplex64 ¶ added in v0.2.1
func CoercedComplex64(params ...any) *ZodComplex[complex64]
CoercedComplex64 creates coerced complex64 schema
func CoercedComplex64Ptr ¶ added in v0.3.0
func CoercedComplex64Ptr(params ...any) *ZodComplex[*complex64]
CoercedComplex64Ptr creates coerced *complex64 schema
func CoercedComplex128 ¶ added in v0.2.1
func CoercedComplex128(params ...any) *ZodComplex[complex128]
CoercedComplex128 creates coerced complex128 schema
func CoercedComplex128Ptr ¶ added in v0.3.0
func CoercedComplex128Ptr(params ...any) *ZodComplex[*complex128]
CoercedComplex128Ptr creates coerced *complex128 schema
func CoercedComplexPtr ¶ added in v0.3.0
func CoercedComplexPtr(params ...any) *ZodComplex[*complex128]
CoercedComplexPtr creates coerced *complex128 schema (default)
func Complex ¶
func Complex(params ...any) *ZodComplex[complex128]
Complex creates complex128 schema (default)
func Complex64 ¶
func Complex64(params ...any) *ZodComplex[complex64]
Complex64 creates complex64 schema
func Complex64Ptr ¶ added in v0.3.0
func Complex64Ptr(params ...any) *ZodComplex[*complex64]
Complex64Ptr creates schema for *complex64
func Complex128 ¶
func Complex128(params ...any) *ZodComplex[complex128]
Complex128 creates complex128 schema
func Complex128Ptr ¶ added in v0.3.0
func Complex128Ptr(params ...any) *ZodComplex[*complex128]
Complex128Ptr creates schema for *complex128
func ComplexPtr ¶ added in v0.3.0
func ComplexPtr(params ...any) *ZodComplex[*complex128]
ComplexPtr creates schema for *complex128 (default)
func ComplexTyped ¶ added in v0.3.0
func ComplexTyped[T ComplexConstraint](params ...any) *ZodComplex[T]
ComplexTyped creates a generic complex schema with automatic type inference. It automatically determines the appropriate type code based on the generic type parameter. Usage: ComplexTyped[complex64](), ComplexTyped[complex128](), ComplexTyped[*complex64](), etc.
func (*ZodComplex[T]) CloneFrom ¶
func (z *ZodComplex[T]) CloneFrom(source any)
CloneFrom copies configuration from another schema
func (*ZodComplex[T]) Coerce ¶
func (z *ZodComplex[T]) Coerce(input any) (any, bool)
Coerce attempts to coerce input to target complex type using coerce package
func (*ZodComplex[T]) Default ¶
func (z *ZodComplex[T]) Default(v complex128) *ZodComplex[T]
Default preserves current generic type T
func (*ZodComplex[T]) DefaultFunc ¶
func (z *ZodComplex[T]) DefaultFunc(fn func() complex128) *ZodComplex[T]
DefaultFunc preserves current generic type T
func (*ZodComplex[T]) Finite ¶ added in v0.3.0
func (z *ZodComplex[T]) Finite(params ...any) *ZodComplex[T]
Finite adds finite validation for complex numbers (no infinite components)
func (*ZodComplex[T]) GetInternals ¶
func (z *ZodComplex[T]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodComplex[T]) Gt ¶
func (z *ZodComplex[T]) Gt(value float64, params ...any) *ZodComplex[T]
Gt adds greater than validation for complex magnitude (exclusive)
func (*ZodComplex[T]) Gte ¶
func (z *ZodComplex[T]) Gte(value float64, params ...any) *ZodComplex[T]
Gte adds greater than or equal validation for complex magnitude (inclusive)
func (*ZodComplex[T]) IsNilable ¶ added in v0.3.0
func (z *ZodComplex[T]) IsNilable() bool
IsNilable returns true if this schema accepts nil values
func (*ZodComplex[T]) IsOptional ¶ added in v0.3.0
func (z *ZodComplex[T]) IsOptional() bool
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodComplex[T]) Lt ¶
func (z *ZodComplex[T]) Lt(value float64, params ...any) *ZodComplex[T]
Lt adds less than validation for complex magnitude (exclusive)
func (*ZodComplex[T]) Lte ¶
func (z *ZodComplex[T]) Lte(value float64, params ...any) *ZodComplex[T]
Lte adds less than or equal validation for complex magnitude (inclusive)
func (*ZodComplex[T]) Max ¶
func (z *ZodComplex[T]) Max(maximum float64, params ...any) *ZodComplex[T]
Max adds maximum magnitude validation for complex numbers
func (*ZodComplex[T]) Meta ¶ added in v0.3.1
func (z *ZodComplex[T]) Meta(meta core.GlobalMeta) *ZodComplex[T]
Meta stores metadata for this complex number schema.
func (*ZodComplex[T]) Min ¶
func (z *ZodComplex[T]) Min(minimum float64, params ...any) *ZodComplex[T]
Min adds minimum magnitude validation for complex numbers
func (*ZodComplex[T]) MustParse ¶
func (z *ZodComplex[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse validates the input value and panics on failure
func (*ZodComplex[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodComplex[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse provides compile-time type safety and panics on validation failure. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodComplex[T]) Negative ¶
func (z *ZodComplex[T]) Negative(params ...any) *ZodComplex[T]
Negative adds negative validation (< 0) - validates real part for complex numbers
func (*ZodComplex[T]) Nilable ¶
func (z *ZodComplex[T]) Nilable() *ZodComplex[*complex128]
Nilable allows nil values, returns pointer type
func (*ZodComplex[T]) NonNegative ¶
func (z *ZodComplex[T]) NonNegative(params ...any) *ZodComplex[T]
NonNegative adds non-negative validation (>= 0) for complex magnitude
func (*ZodComplex[T]) NonPositive ¶
func (z *ZodComplex[T]) NonPositive(params ...any) *ZodComplex[T]
NonPositive adds non-positive validation (<= 0) for complex magnitude
func (*ZodComplex[T]) Nullish ¶
func (z *ZodComplex[T]) Nullish() *ZodComplex[*complex128]
Nullish combines optional and nilable modifiers
func (*ZodComplex[T]) Optional ¶
func (z *ZodComplex[T]) Optional() *ZodComplex[*complex128]
Optional always returns *complex128 for nullable semantics
func (*ZodComplex[T]) Overwrite ¶ added in v0.3.0
func (z *ZodComplex[T]) Overwrite(transform func(T) T, params ...any) *ZodComplex[T]
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodComplex[T]) Parse ¶
func (z *ZodComplex[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse validates input using unified ParsePrimitive API
func (*ZodComplex[T]) ParseAny ¶ added in v0.3.0
func (z *ZodComplex[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodComplex[T]) Positive ¶
func (z *ZodComplex[T]) Positive(params ...any) *ZodComplex[T]
Positive adds positive magnitude validation (> 0) for complex numbers
func (*ZodComplex[T]) Prefault ¶
func (z *ZodComplex[T]) Prefault(v complex128) *ZodComplex[T]
Prefault provides fallback values on validation failure
func (*ZodComplex[T]) PrefaultFunc ¶
func (z *ZodComplex[T]) PrefaultFunc(fn func() complex128) *ZodComplex[T]
PrefaultFunc keeps the current generic type T.
func (*ZodComplex[T]) Refine ¶
func (z *ZodComplex[T]) Refine(fn func(T) bool, params ...any) *ZodComplex[T]
Refine applies type-safe validation with automatic type conversion
func (*ZodComplex[T]) RefineAny ¶
func (z *ZodComplex[T]) RefineAny(fn func(any) bool, params ...any) *ZodComplex[T]
RefineAny provides flexible validation without type conversion
func (*ZodComplex[T]) StrictParse ¶ added in v0.4.0
func (z *ZodComplex[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodComplex[T]) Transform ¶
func (z *ZodComplex[T]) Transform(fn func(complex128, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
Transform creates a type-safe transformation using the WrapFn pattern
type ZodComplexDef ¶
type ZodComplexDef struct {
core.ZodTypeDef
}
ZodComplexDef defines the schema definition for complex number validation
type ZodComplexInternals ¶
type ZodComplexInternals struct {
core.ZodTypeInternals
Def *ZodComplexDef // Schema definition reference
}
ZodComplexInternals contains the internal state for complex schema
type ZodDiscriminatedUnion ¶
ZodDiscriminatedUnion represents a discriminated union validation schema with dual generic parameters T = base type (any), R = constraint type (any or *any)
func DiscriminatedUnion ¶
func DiscriminatedUnion(discriminator string, options []any, args ...any) *ZodDiscriminatedUnion[any, any]
DiscriminatedUnion creates discriminated union schema that accepts one of the specified object types - returns value constraint
func DiscriminatedUnionPtr ¶ added in v0.3.0
func DiscriminatedUnionPtr(discriminator string, options []any, args ...any) *ZodDiscriminatedUnion[any, *any]
DiscriminatedUnionPtr creates discriminated union schema that accepts one of the specified object types - returns pointer constraint
func DiscriminatedUnionTyped ¶ added in v0.3.0
func DiscriminatedUnionTyped[T any, R any](discriminator string, options []any, args ...any) *ZodDiscriminatedUnion[T, R]
DiscriminatedUnionTyped creates typed discriminated union schema with generic constraints
func (*ZodDiscriminatedUnion[T, R]) CloneFrom ¶
func (z *ZodDiscriminatedUnion[T, R]) CloneFrom(source any)
CloneFrom copies configuration from another schema
func (*ZodDiscriminatedUnion[T, R]) Default ¶
func (z *ZodDiscriminatedUnion[T, R]) Default(v T) *ZodDiscriminatedUnion[T, R]
Default preserves current constraint type R
func (*ZodDiscriminatedUnion[T, R]) DefaultFunc ¶
func (z *ZodDiscriminatedUnion[T, R]) DefaultFunc(fn func() T) *ZodDiscriminatedUnion[T, R]
DefaultFunc preserves current constraint type R
func (*ZodDiscriminatedUnion[T, R]) Discriminator ¶
func (z *ZodDiscriminatedUnion[T, R]) Discriminator() string
Discriminator returns the discriminator field name
func (*ZodDiscriminatedUnion[T, R]) DiscriminatorMap ¶ added in v0.3.0
func (z *ZodDiscriminatedUnion[T, R]) DiscriminatorMap() map[any]core.ZodSchema
DiscriminatorMap returns the discriminator value to schema mapping
func (*ZodDiscriminatedUnion[T, R]) GetInternals ¶
func (z *ZodDiscriminatedUnion[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodDiscriminatedUnion[T, R]) IsNilable ¶ added in v0.3.0
func (z *ZodDiscriminatedUnion[T, R]) IsNilable() bool
IsNilable returns true if this schema accepts nil values
func (*ZodDiscriminatedUnion[T, R]) IsOptional ¶ added in v0.3.0
func (z *ZodDiscriminatedUnion[T, R]) IsOptional() bool
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodDiscriminatedUnion[T, R]) Meta ¶ added in v0.3.1
func (z *ZodDiscriminatedUnion[T, R]) Meta(meta core.GlobalMeta) *ZodDiscriminatedUnion[T, R]
Meta stores metadata for this discriminated union schema.
func (*ZodDiscriminatedUnion[T, R]) MustParse ¶
func (z *ZodDiscriminatedUnion[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodDiscriminatedUnion[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodDiscriminatedUnion[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodDiscriminatedUnion[T, R]) Nilable ¶
func (z *ZodDiscriminatedUnion[T, R]) Nilable() *ZodDiscriminatedUnion[T, *T]
Nilable allows nil values and returns pointer constraint
func (*ZodDiscriminatedUnion[T, R]) Nullish ¶ added in v0.3.0
func (z *ZodDiscriminatedUnion[T, R]) Nullish() *ZodDiscriminatedUnion[T, *T]
Nullish combines optional and nilable modifiers
func (*ZodDiscriminatedUnion[T, R]) Optional ¶
func (z *ZodDiscriminatedUnion[T, R]) Optional() *ZodDiscriminatedUnion[T, *T]
Optional creates optional discriminated union schema that returns pointer constraint
func (*ZodDiscriminatedUnion[T, R]) Options ¶
func (z *ZodDiscriminatedUnion[T, R]) Options() []core.ZodSchema
Options returns all union member schemas
func (*ZodDiscriminatedUnion[T, R]) Parse ¶
func (z *ZodDiscriminatedUnion[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using discriminated union logic with direct validation approach
func (*ZodDiscriminatedUnion[T, R]) ParseAny ¶ added in v0.3.0
func (z *ZodDiscriminatedUnion[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodDiscriminatedUnion[T, R]) Pipe ¶
Pipe creates validation pipeline to another schema using WrapFn pattern
func (*ZodDiscriminatedUnion[T, R]) Prefault ¶
func (z *ZodDiscriminatedUnion[T, R]) Prefault(v T) *ZodDiscriminatedUnion[T, R]
Prefault provides fallback values on validation failure
func (*ZodDiscriminatedUnion[T, R]) PrefaultFunc ¶
func (z *ZodDiscriminatedUnion[T, R]) PrefaultFunc(fn func() T) *ZodDiscriminatedUnion[T, R]
PrefaultFunc keeps current generic type R.
func (*ZodDiscriminatedUnion[T, R]) Refine ¶
func (z *ZodDiscriminatedUnion[T, R]) Refine(fn func(R) bool, params ...any) *ZodDiscriminatedUnion[T, R]
Refine applies type-safe validation with constraint type R
func (*ZodDiscriminatedUnion[T, R]) RefineAny ¶
func (z *ZodDiscriminatedUnion[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodDiscriminatedUnion[T, R]
RefineAny provides flexible validation without type conversion
func (*ZodDiscriminatedUnion[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodDiscriminatedUnion[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodDiscriminatedUnion[T, R]) Transform ¶
func (z *ZodDiscriminatedUnion[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform creates type-safe transformation pipeline using WrapFn pattern
type ZodDiscriminatedUnionDef ¶
type ZodDiscriminatedUnionDef struct {
core.ZodTypeDef
Discriminator string // The discriminator field name
Options []core.ZodSchema // Union member schemas using unified interface
}
ZodDiscriminatedUnionDef defines the configuration for discriminated union validation
type ZodDiscriminatedUnionInternals ¶
type ZodDiscriminatedUnionInternals struct {
core.ZodTypeInternals
Def *ZodDiscriminatedUnionDef // Schema definition reference
Discriminator string // The discriminator field name
Options []core.ZodSchema // Union member schemas for runtime validation
DiscMap map[any]core.ZodSchema // Discriminator value to schema mapping
}
ZodDiscriminatedUnionInternals contains discriminated union validator internal state
type ZodEmail ¶ added in v0.3.0
type ZodEmail[T EmailConstraint] struct{ *ZodString[T] }
func EmailTyped ¶ added in v0.3.0
func EmailTyped[T EmailConstraint](params ...any) *ZodEmail[T]
EmailTyped creates an email validation schema with specific type
func (*ZodEmail[T]) GetInternals ¶ added in v0.3.0
func (z *ZodEmail[T]) GetInternals() *core.ZodTypeInternals
GetInternals proxies to the embedded string schema.
func (*ZodEmail[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodEmail[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodEmail[T]) StrictParse ¶ added in v0.4.0
func (z *ZodEmail[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodEmoji ¶ added in v0.3.0
type ZodEmoji[T StringConstraint] struct{ *ZodString[T] }
func (*ZodEmoji[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodEmoji[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodEmoji[T]) StrictParse ¶ added in v0.4.0
func (z *ZodEmoji[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodEnum ¶
type ZodEnum[T comparable, R any] struct { // contains filtered or unexported fields }
ZodEnum represents a type-safe enum validation schema with unified constraint T is the base comparable type, R is the constraint type (T | *T)
func Enum ¶
func Enum[T comparable](values ...T) *ZodEnum[T, T]
Enum creates enum schema from values with type-inference support
func EnumMap ¶
func EnumMap[T comparable](entries map[string]T, params ...any) *ZodEnum[T, T]
EnumMap creates enum schema from key-value mapping
func EnumMapPtr ¶ added in v0.3.0
func EnumMapPtr[T comparable](entries map[string]T, params ...any) *ZodEnum[T, *T]
EnumMapPtr creates pointer-capable enum schema from key-value mapping
func EnumMapTyped ¶ added in v0.3.0
func EnumMapTyped[T comparable, R any](entries map[string]T, args ...any) *ZodEnum[T, R]
EnumMapTyped is the generic constructor for enum schemas from mapping
func EnumPtr ¶ added in v0.3.0
func EnumPtr[T comparable](values ...T) *ZodEnum[T, *T]
EnumPtr creates pointer-capable enum schema from values
func EnumSlice ¶
func EnumSlice[T comparable](values []T) *ZodEnum[T, T]
EnumSlice creates enum schema from slice of values
func EnumSlicePtr ¶ added in v0.3.0
func EnumSlicePtr[T comparable](values []T) *ZodEnum[T, *T]
EnumSlicePtr creates pointer-capable enum schema from slice of values
func (*ZodEnum[T, R]) CloneFrom ¶ added in v0.3.0
CloneFrom copies configuration from another schema
func (*ZodEnum[T, R]) DefaultFunc ¶
DefaultFunc keeps the current generic constraint type R.
func (*ZodEnum[T, R]) Exclude ¶
Exclude creates a sub-enum excluding specified keys Non-existent keys are silently ignored to maintain fluent interface design
func (*ZodEnum[T, R]) Extract ¶
Extract creates a sub-enum with specified keys Non-existent keys are silently ignored to maintain fluent interface design
func (*ZodEnum[T, R]) GetInternals ¶
func (z *ZodEnum[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodEnum[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodEnum[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodEnum[T, R]) Meta ¶ added in v0.3.1
func (z *ZodEnum[T, R]) Meta(meta core.GlobalMeta) *ZodEnum[T, R]
Meta stores metadata for this enum schema.
func (*ZodEnum[T, R]) MustParse ¶
func (z *ZodEnum[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodEnum[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodEnum[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodEnum[T, R]) Nullish ¶
Nullish combines optional and nilable modifiers for maximum flexibility
func (*ZodEnum[T, R]) Optional ¶
Optional always returns *T constraint because the optional value may be nil.
func (*ZodEnum[T, R]) Options ¶
func (z *ZodEnum[T, R]) Options() []T
Options returns all possible enum values
func (*ZodEnum[T, R]) Parse ¶
func (z *ZodEnum[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using enum-specific parsing logic
func (*ZodEnum[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodEnum[T, R]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodEnum[T, R]) Refine ¶
Refine applies type-safe validation that matches the schema's output type R. The callback will be executed even when the value is nil (for *T schemas) to align with Zod v4 semantics.
func (*ZodEnum[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodEnum[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type R.
func (*ZodEnum[T, R]) Transform ¶
func (z *ZodEnum[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using the WrapFn pattern.
type ZodEnumDef ¶
type ZodEnumDef[T comparable] struct { core.ZodTypeDef Entries map[string]T // Enum key-value mapping }
ZodEnumDef defines the schema definition for enum validation
type ZodEnumInternals ¶
type ZodEnumInternals[T comparable] struct { core.ZodTypeInternals Def *ZodEnumDef[T] // Schema definition reference Entries map[string]T // Enum key-value mapping Values map[T]struct{} // Set of valid values for fast lookup Pattern *regexp.Regexp // Compiled regex pattern for validation }
ZodEnumInternals contains the internal state for enum schema
type ZodFile ¶
ZodFile represents a file validation schema with constraint types T and R
func (*ZodFile[T, R]) DefaultFunc ¶
DefaultFunc sets a default function for the file type
func (*ZodFile[T, R]) GetInternals ¶
func (z *ZodFile[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state for interface compatibility
func (*ZodFile[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns whether the file type is nilable
func (*ZodFile[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns whether the file type is optional
func (*ZodFile[T, R]) Meta ¶ added in v0.3.1
func (z *ZodFile[T, R]) Meta(meta core.GlobalMeta) *ZodFile[T, R]
Meta adds metadata to the file type
func (*ZodFile[T, R]) MustParse ¶
func (z *ZodFile[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse is the variant that panics on error
func (*ZodFile[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodFile[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodFile[T, R]) Optional ¶
Optional makes the file type optional and returns pointer constraint
func (*ZodFile[T, R]) Overwrite ¶ added in v0.3.0
Overwrite applies a transformation function to the file value
func (*ZodFile[T, R]) Parse ¶
func (z *ZodFile[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse returns a validated file using direct validation for better performance
func (*ZodFile[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodFile[T, R]) PrefaultFunc ¶
PrefaultFunc sets a prefault function for the file type
func (*ZodFile[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodFile[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse validates input with compile-time type safety and enhanced performance. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodFile[T, R]) Transform ¶
func (z *ZodFile[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform creates a transformation pipeline
type ZodFileDef ¶
type ZodFileDef struct {
core.ZodTypeDef
}
ZodFileDef represents the definition for a file type
type ZodFileInternals ¶
type ZodFileInternals struct {
core.ZodTypeInternals
Def *ZodFileDef // Schema definition
}
ZodFileInternals holds the internal state for file validation
type ZodFloat ¶
type ZodFloat[T FloatConstraint, R any] = ZodFloatTyped[T, R]
ZodFloat is now a generic type alias for ZodFloatTyped This provides a unified interface for all float types
type ZodFloatDef ¶
type ZodFloatDef struct {
core.ZodTypeDef
}
ZodFloatDef defines the configuration for float validation
type ZodFloatInternals ¶
type ZodFloatInternals struct {
core.ZodTypeInternals
Def *ZodFloatDef // Schema definition
}
ZodFloatInternals contains float validator internal state
type ZodFloatTyped ¶ added in v0.3.0
type ZodFloatTyped[T FloatConstraint, R any] struct { // contains filtered or unexported fields }
ZodFloatTyped represents a floating-point validation schema with dual generic parameters T = base type (float32, float64, etc.), R = constraint type (T or *T)
func CoercedFloat ¶ added in v0.3.0
func CoercedFloat[T FloatConstraint](params ...any) *ZodFloatTyped[T, T]
CoercedFloat creates a flexible float schema with coercion enabled
func CoercedFloat32 ¶ added in v0.2.1
func CoercedFloat32(params ...any) *ZodFloatTyped[float32, float32]
CoercedFloat32 creates a float32 schema with coercion enabled
func CoercedFloat32Ptr ¶ added in v0.3.0
func CoercedFloat32Ptr(params ...any) *ZodFloatTyped[float32, *float32]
CoercedFloat32Ptr creates a *float32 schema with coercion enabled
func CoercedFloat64 ¶ added in v0.2.1
func CoercedFloat64(params ...any) *ZodFloatTyped[float64, float64]
CoercedFloat64 creates a float64 schema with coercion enabled
func CoercedFloat64Ptr ¶ added in v0.3.0
func CoercedFloat64Ptr(params ...any) *ZodFloatTyped[float64, *float64]
CoercedFloat64Ptr creates a *float64 schema with coercion enabled
func CoercedFloatPtr ¶ added in v0.3.0
func CoercedFloatPtr(params ...any) *ZodFloatTyped[float64, *float64]
CoercedFloatPtr creates a *float64 schema with coercion enabled
func CoercedNumber ¶ added in v0.2.1
func CoercedNumber(params ...any) *ZodFloatTyped[float64, float64]
CoercedNumber creates a number schema with coercion enabled (alias for CoercedFloat64)
func CoercedNumberPtr ¶ added in v0.3.0
func CoercedNumberPtr(params ...any) *ZodFloatTyped[float64, *float64]
CoercedNumberPtr creates a *number schema with coercion enabled (alias for CoercedFloat64Ptr)
func Float ¶
func Float(params ...any) *ZodFloatTyped[float64, float64]
Float creates a flexible float64 schema (alias for Float64).
func Float32 ¶
func Float32(params ...any) *ZodFloatTyped[float32, float32]
Float32 creates a float32 schema
func Float32Ptr ¶ added in v0.3.0
func Float32Ptr(params ...any) *ZodFloatTyped[float32, *float32]
Float32Ptr creates a schema for *float32.
func Float64 ¶
func Float64(params ...any) *ZodFloatTyped[float64, float64]
Float64 creates a float64 schema
func Float64Ptr ¶ added in v0.3.0
func Float64Ptr(params ...any) *ZodFloatTyped[float64, *float64]
Float64Ptr creates a schema for *float64.
func FloatPtr ¶ added in v0.3.0
func FloatPtr(params ...any) *ZodFloatTyped[float64, *float64]
FloatPtr creates a schema for *float64 (alias for Float64Ptr).
func FloatTyped ¶ added in v0.3.0
func FloatTyped[T FloatConstraint](params ...any) *ZodFloatTyped[T, T]
FloatTyped creates a generic float schema with automatic type inference. It automatically determines the appropriate type code based on the generic type parameter. Usage: FloatTyped[float32](), FloatTyped[float64](), etc.
func Number ¶
func Number(params ...any) *ZodFloatTyped[float64, float64]
Number creates a number schema (alias for Float64).
func NumberPtr ¶ added in v0.3.0
func NumberPtr(params ...any) *ZodFloatTyped[float64, *float64]
NumberPtr creates a schema for *float64 (alias for Float64Ptr).
func (*ZodFloatTyped[T, R]) Check ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodFloatTyped[T, R]
Check adds a custom validation function for ZodFloatTyped that can report multiple issues.
func (*ZodFloatTyped[T, R]) CloneFrom ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) CloneFrom(source any)
CloneFrom copies configuration from another schema
func (*ZodFloatTyped[T, R]) Coerce ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Coerce(input any) (any, bool)
Coerce implements Coercible interface for float type conversion
func (*ZodFloatTyped[T, R]) Default ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Default(v float64) *ZodFloatTyped[T, R]
Default keeps the current constraint type R.
func (*ZodFloatTyped[T, R]) DefaultFunc ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) DefaultFunc(fn func() float64) *ZodFloatTyped[T, R]
DefaultFunc keeps the current constraint type R.
func (*ZodFloatTyped[T, R]) Finite ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Finite(params ...any) *ZodFloatTyped[T, R]
Finite adds finite number validation (not NaN or Infinity)
func (*ZodFloatTyped[T, R]) GetInternals ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodFloatTyped[T, R]) Gt ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Gt(value float64, params ...any) *ZodFloatTyped[T, R]
Gt adds greater than validation (exclusive)
func (*ZodFloatTyped[T, R]) Gte ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Gte(value float64, params ...any) *ZodFloatTyped[T, R]
Gte adds greater than or equal validation (inclusive)
func (*ZodFloatTyped[T, R]) Int ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Int(params ...any) *ZodFloatTyped[T, R]
Int adds integer validation (no decimal part)
func (*ZodFloatTyped[T, R]) IsNilable ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) IsNilable() bool
IsNilable returns true if this schema accepts nil values
func (*ZodFloatTyped[T, R]) IsOptional ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) IsOptional() bool
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodFloatTyped[T, R]) Lt ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Lt(value float64, params ...any) *ZodFloatTyped[T, R]
Lt adds less than validation (exclusive)
func (*ZodFloatTyped[T, R]) Lte ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Lte(value float64, params ...any) *ZodFloatTyped[T, R]
Lte adds less than or equal validation (inclusive)
func (*ZodFloatTyped[T, R]) Max ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Max(maximum float64, params ...any) *ZodFloatTyped[T, R]
Max adds maximum value validation (alias for Lte)
func (*ZodFloatTyped[T, R]) Meta ¶ added in v0.3.1
func (z *ZodFloatTyped[T, R]) Meta(meta core.GlobalMeta) *ZodFloatTyped[T, R]
Meta stores metadata for this float schema in the global registry.
func (*ZodFloatTyped[T, R]) Min ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Min(minimum float64, params ...any) *ZodFloatTyped[T, R]
Min adds minimum value validation (alias for Gte)
func (*ZodFloatTyped[T, R]) MultipleOf ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) MultipleOf(value float64, params ...any) *ZodFloatTyped[T, R]
MultipleOf adds multiple of validation
func (*ZodFloatTyped[T, R]) MustParse ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse is the type-safe variant that panics on error.
func (*ZodFloatTyped[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodFloatTyped[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
func (*ZodFloatTyped[T, R]) Negative ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Negative(params ...any) *ZodFloatTyped[T, R]
Negative adds negative number validation (< 0)
func (*ZodFloatTyped[T, R]) Nilable ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Nilable() *ZodFloatTyped[T, *T]
Nilable returns a schema that accepts the base type T or nil, with constraint type *T.
func (*ZodFloatTyped[T, R]) NonNegative ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) NonNegative(params ...any) *ZodFloatTyped[T, R]
NonNegative adds non-negative number validation (>= 0, alias for nonnegative)
func (*ZodFloatTyped[T, R]) NonOptional ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) NonOptional() *ZodFloatTyped[T, T]
NonOptional removes optional flag and returns value constraint (T). Mirrors Optional() -> NonOptional() pattern, enabling strict non-nil validation.
func (*ZodFloatTyped[T, R]) NonPositive ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) NonPositive(params ...any) *ZodFloatTyped[T, R]
NonPositive adds non-positive number validation (<= 0, alias for nonpositive)
func (*ZodFloatTyped[T, R]) Nullish ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Nullish() *ZodFloatTyped[T, *T]
Nullish combines optional and nilable modifiers for maximum flexibility.
func (*ZodFloatTyped[T, R]) Optional ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Optional() *ZodFloatTyped[T, *T]
Optional returns a schema that accepts the base type T or nil, with constraint type *T.
func (*ZodFloatTyped[T, R]) Overwrite ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Overwrite(transform func(T) T, params ...any) *ZodFloatTyped[T, R]
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodFloatTyped[T, R]) Parse ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse returns a value that matches the constraint type R with full type safety.
func (*ZodFloatTyped[T, R]) ParseAny ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodFloatTyped[T, R]) Pipe ¶ added in v0.3.0
Pipe creates a pipeline using the WrapFn pattern. Instead of using adapter structures, this creates a target function that handles type conversion.
func (*ZodFloatTyped[T, R]) Positive ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Positive(params ...any) *ZodFloatTyped[T, R]
Positive adds positive number validation (> 0)
func (*ZodFloatTyped[T, R]) Prefault ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Prefault(v float64) *ZodFloatTyped[T, R]
Prefault keeps the current constraint type R.
func (*ZodFloatTyped[T, R]) PrefaultFunc ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) PrefaultFunc(fn func() float64) *ZodFloatTyped[T, R]
PrefaultFunc keeps the current constraint type R.
func (*ZodFloatTyped[T, R]) Refine ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Refine(fn func(T) bool, params ...any) *ZodFloatTyped[T, R]
Refine applies type-safe validation using the base type T instead of constraint type T. The callback will be executed even when the value is nil (for pointer schemas) to align with Zod v4 semantics.
func (*ZodFloatTyped[T, R]) RefineAny ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodFloatTyped[T, R]
RefineAny adds flexible custom validation logic
func (*ZodFloatTyped[T, R]) Safe ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Safe(params ...any) *ZodFloatTyped[T, R]
Safe adds safe number validation (within JavaScript safe integer range)
func (*ZodFloatTyped[T, R]) Step ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Step(step float64, params ...any) *ZodFloatTyped[T, R]
Step adds step validation (alias for MultipleOf to match Zod)
func (*ZodFloatTyped[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodFloatTyped[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type R.
func (*ZodFloatTyped[T, R]) Transform ¶ added in v0.3.0
func (z *ZodFloatTyped[T, R]) Transform(fn func(float64, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using the WrapFn pattern. Float types implement direct extraction of float64 values for transformation.
WrapFn Implementation:
- Create a wrapper function that extracts float64 from constraint type R
- Apply the user's transformation function to the extracted float64
- Return a ZodTransform with the wrapper function
Zero Redundancy:
- No floatTypeConverter structure needed
- Direct function composition for maximum performance
- Type-safe extraction from constraint type R to float64
Example:
schema := Float64().Min(0.0).Transform(func(f float64, ctx *RefinementContext) (string, error) {
return fmt.Sprintf("%.2f", f), nil
})
type ZodFunction ¶
type ZodFunction[T FunctionConstraint] struct { // contains filtered or unexported fields }
ZodFunction represents a function validation schema with type safety
func FunctionPtr ¶ added in v0.3.0
func FunctionPtr(params ...any) *ZodFunction[*any]
FunctionPtr creates a schema for *function
func FunctionTyped ¶ added in v0.3.0
func FunctionTyped[T FunctionConstraint](params ...any) *ZodFunction[T]
FunctionTyped is the underlying generic function for creating function schemas
func (*ZodFunction[T]) CloneFrom ¶ added in v0.3.0
func (z *ZodFunction[T]) CloneFrom(source any)
CloneFrom copies configuration from another schema
func (*ZodFunction[T]) Default ¶
func (z *ZodFunction[T]) Default(v any) *ZodFunction[T]
Default preserves the current generic type T
func (*ZodFunction[T]) DefaultFunc ¶
func (z *ZodFunction[T]) DefaultFunc(fn func() any) *ZodFunction[T]
DefaultFunc preserves the current generic type T
func (*ZodFunction[T]) GetInternals ¶
func (z *ZodFunction[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodFunction[T]) Implement ¶
func (z *ZodFunction[T]) Implement(fn any) (any, error)
Implement wraps a function with input/output validation
func (*ZodFunction[T]) Input ¶
func (z *ZodFunction[T]) Input(inputSchema core.ZodType[any]) *ZodFunction[T]
Input sets the input schema for function arguments
func (*ZodFunction[T]) IsNilable ¶ added in v0.3.0
func (z *ZodFunction[T]) IsNilable() bool
IsNilable returns true if this schema accepts nil values
func (*ZodFunction[T]) IsOptional ¶ added in v0.3.0
func (z *ZodFunction[T]) IsOptional() bool
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodFunction[T]) Meta ¶ added in v0.3.1
func (z *ZodFunction[T]) Meta(meta core.GlobalMeta) *ZodFunction[T]
Meta stores metadata for this function schema.
func (*ZodFunction[T]) MustParse ¶
func (z *ZodFunction[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the type-safe variant that panics on error
func (*ZodFunction[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodFunction[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodFunction[T]) Nilable ¶
func (z *ZodFunction[T]) Nilable() *ZodFunction[*any]
Nilable allows the function to be nil
func (*ZodFunction[T]) Nullish ¶
func (z *ZodFunction[T]) Nullish() *ZodFunction[*any]
Nullish combines optional and nilable modifiers
func (*ZodFunction[T]) Optional ¶
func (z *ZodFunction[T]) Optional() *ZodFunction[*any]
Optional allows the function to be nil
func (*ZodFunction[T]) Output ¶
func (z *ZodFunction[T]) Output(outputSchema core.ZodType[any]) *ZodFunction[T]
Output sets the output schema for function return value
func (*ZodFunction[T]) Overwrite ¶ added in v0.3.0
func (z *ZodFunction[T]) Overwrite(transform func(T) T, params ...any) *ZodFunction[T]
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodFunction[T]) Parse ¶
func (z *ZodFunction[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse validates and returns a function that performs input/output validation
func (*ZodFunction[T]) ParseAny ¶ added in v0.3.0
func (z *ZodFunction[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodFunction[T]) Prefault ¶
func (z *ZodFunction[T]) Prefault(v any) *ZodFunction[T]
Prefault preserves the current generic type T
func (*ZodFunction[T]) PrefaultFunc ¶
func (z *ZodFunction[T]) PrefaultFunc(fn func() any) *ZodFunction[T]
PrefaultFunc preserves the current generic type T
func (*ZodFunction[T]) Refine ¶
func (z *ZodFunction[T]) Refine(fn func(T) bool, params ...any) *ZodFunction[T]
Refine applies custom validation function
func (*ZodFunction[T]) RefineAny ¶
func (z *ZodFunction[T]) RefineAny(fn func(any) bool, params ...any) *ZodFunction[T]
RefineAny adds flexible custom validation logic
func (*ZodFunction[T]) StrictParse ¶ added in v0.4.0
func (z *ZodFunction[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
func (*ZodFunction[T]) Transform ¶
func (z *ZodFunction[T]) Transform(fn func(any, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
Transform creates a type-safe transformation using WrapFn pattern
type ZodFunctionDef ¶
type ZodFunctionDef struct {
core.ZodTypeDef
Input core.ZodType[any] // Schema for validating input arguments
Output core.ZodType[any] // Schema for validating output result
}
ZodFunctionDef defines the configuration for function validation
type ZodFunctionInternals ¶
type ZodFunctionInternals struct {
core.ZodTypeInternals
Def *ZodFunctionDef // Schema definition
Input core.ZodType[any] // Input validation schema
Output core.ZodType[any] // Output validation schema
}
ZodFunctionInternals contains function validator internal state
type ZodIPv4 ¶
type ZodIPv4[T NetworkConstraint] struct { // contains filtered or unexported fields }
ZodIPv4 represents an IPv4 address validation schema
func CoercedIPv4 ¶ added in v0.3.0
CoercedIPv4 creates coerced IPv4 schema that attempts string conversion
func IPv4Typed ¶ added in v0.3.0
func IPv4Typed[T NetworkConstraint](params ...any) *ZodIPv4[T]
IPv4Typed is the generic constructor for IPv4 address schemas
func (*ZodIPv4[T]) Coerce ¶ added in v0.3.0
Coerce implements type conversion interface using coerce package
func (*ZodIPv4[T]) DefaultFunc ¶
DefaultFunc preserves current generic type T
func (*ZodIPv4[T]) GetInternals ¶
func (z *ZodIPv4[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodIPv4[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodIPv4[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodIPv4[T]) MustParse ¶
func (z *ZodIPv4[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the variant that panics on error
func (*ZodIPv4[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodIPv4[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
func (*ZodIPv4[T]) Optional ¶
Optional allows nil values, returns pointer type for nullable semantics
func (*ZodIPv4[T]) Parse ¶
func (z *ZodIPv4[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns type-safe IPv4 address using unified engine API
func (*ZodIPv4[T]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodIPv4[T]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodIPv4[T]) StrictParse ¶ added in v0.4.0
func (z *ZodIPv4[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodIPv4Def ¶
type ZodIPv4Def struct {
core.ZodTypeDef
}
ZodIPv4Def defines the configuration for IPv4 address validation
type ZodIPv4Internals ¶
type ZodIPv4Internals struct {
core.ZodTypeInternals
Def *ZodIPv4Def // Schema definition
}
ZodIPv4Internals contains IPv4 validator internal state
type ZodIPv6 ¶
type ZodIPv6[T NetworkConstraint] struct { // contains filtered or unexported fields }
ZodIPv6 represents an IPv6 address validation schema
func CoercedIPv6 ¶ added in v0.3.0
CoercedIPv6 creates coerced IPv6 schema that attempts string conversion
func IPv6Typed ¶ added in v0.3.0
func IPv6Typed[T NetworkConstraint](params ...any) *ZodIPv6[T]
IPv6Typed is the generic constructor for IPv6 address schemas
func (*ZodIPv6[T]) Coerce ¶ added in v0.3.0
Coerce implements type conversion interface using coerce package
func (*ZodIPv6[T]) DefaultFunc ¶
DefaultFunc preserves current generic type T
func (*ZodIPv6[T]) GetInternals ¶
func (z *ZodIPv6[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodIPv6[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodIPv6[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodIPv6[T]) MustParse ¶
func (z *ZodIPv6[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the variant that panics on error
func (*ZodIPv6[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodIPv6[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
func (*ZodIPv6[T]) Optional ¶
Optional allows nil values, returns pointer type for nullable semantics
func (*ZodIPv6[T]) Parse ¶
func (z *ZodIPv6[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns type-safe IPv6 address using unified engine API
func (*ZodIPv6[T]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodIPv6[T]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodIPv6[T]) StrictParse ¶ added in v0.4.0
func (z *ZodIPv6[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodIPv6Def ¶
type ZodIPv6Def struct {
core.ZodTypeDef
}
ZodIPv6Def defines the configuration for IPv6 address validation
type ZodIPv6Internals ¶
type ZodIPv6Internals struct {
core.ZodTypeInternals
Def *ZodIPv6Def // Schema definition
}
ZodIPv6Internals contains IPv6 validator internal state
type ZodInteger ¶
type ZodInteger[T IntegerConstraint, R any] = ZodIntegerTyped[T, R]
ZodInteger represents a flexible integer validation schema that accepts any integer type This is a type alias for ZodIntegerTyped[int64, int64] to provide a unified interface
type ZodIntegerDef ¶
type ZodIntegerDef struct {
core.ZodTypeDef
}
ZodIntegerDef defines the configuration for integer validation
type ZodIntegerInternals ¶
type ZodIntegerInternals struct {
core.ZodTypeInternals
Def *ZodIntegerDef // Schema definition
}
ZodIntegerInternals contains integer validator internal state
type ZodIntegerTyped ¶ added in v0.3.0
type ZodIntegerTyped[T IntegerConstraint, R any] struct { // contains filtered or unexported fields }
ZodIntegerTyped represents an integer validation schema with dual generic parameters T = base type (int, int32, int64, etc.), R = constraint type (T or *T)
func Byte ¶
func Byte(params ...any) *ZodIntegerTyped[uint8, uint8]
Byte creates a uint8 schema (alias for byte).
func BytePtr ¶ added in v0.3.0
func BytePtr(params ...any) *ZodIntegerTyped[uint8, *uint8]
BytePtr creates a schema for *uint8 (alias for *byte).
func CoercedInt ¶ added in v0.2.1
func CoercedInt(params ...any) *ZodIntegerTyped[int, int]
CoercedInt creates an int schema with coercion enabled
func CoercedInt8 ¶ added in v0.2.1
func CoercedInt8(params ...any) *ZodIntegerTyped[int8, int8]
CoercedInt8 creates an int8 schema with coercion enabled
func CoercedInt8Ptr ¶ added in v0.3.0
func CoercedInt8Ptr(params ...any) *ZodIntegerTyped[int8, *int8]
CoercedInt8Ptr creates a *int8 schema with coercion enabled
func CoercedInt16 ¶ added in v0.2.1
func CoercedInt16(params ...any) *ZodIntegerTyped[int16, int16]
CoercedInt16 creates an int16 schema with coercion enabled
func CoercedInt16Ptr ¶ added in v0.3.0
func CoercedInt16Ptr(params ...any) *ZodIntegerTyped[int16, *int16]
CoercedInt16Ptr creates a *int16 schema with coercion enabled
func CoercedInt32 ¶ added in v0.2.1
func CoercedInt32(params ...any) *ZodIntegerTyped[int32, int32]
CoercedInt32 creates an int32 schema with coercion enabled
func CoercedInt32Ptr ¶ added in v0.3.0
func CoercedInt32Ptr(params ...any) *ZodIntegerTyped[int32, *int32]
CoercedInt32Ptr creates a *int32 schema with coercion enabled
func CoercedInt64 ¶ added in v0.2.1
func CoercedInt64(params ...any) *ZodIntegerTyped[int64, int64]
CoercedInt64 creates an int64 schema with coercion enabled
func CoercedInt64Ptr ¶ added in v0.3.0
func CoercedInt64Ptr(params ...any) *ZodIntegerTyped[int64, *int64]
CoercedInt64Ptr creates a *int64 schema with coercion enabled
func CoercedIntPtr ¶ added in v0.3.0
func CoercedIntPtr(params ...any) *ZodIntegerTyped[int, *int]
CoercedIntPtr creates a *int schema with coercion enabled
func CoercedInteger ¶ added in v0.3.0
func CoercedInteger(params ...any) *ZodIntegerTyped[int64, int64]
CoercedInteger creates a int64 schema with coercion enabled
func CoercedIntegerPtr ¶ added in v0.3.0
func CoercedIntegerPtr(params ...any) *ZodIntegerTyped[int64, *int64]
CoercedIntegerPtr creates a *int64 schema with coercion enabled
func CoercedUint ¶ added in v0.2.1
func CoercedUint(params ...any) *ZodIntegerTyped[uint, uint]
CoercedUint creates a uint schema with coercion enabled
func CoercedUint8 ¶ added in v0.2.1
func CoercedUint8(params ...any) *ZodIntegerTyped[uint8, uint8]
CoercedUint8 creates a uint8 schema with coercion enabled
func CoercedUint8Ptr ¶ added in v0.3.0
func CoercedUint8Ptr(params ...any) *ZodIntegerTyped[uint8, *uint8]
CoercedUint8Ptr creates a *uint8 schema with coercion enabled
func CoercedUint16 ¶ added in v0.2.1
func CoercedUint16(params ...any) *ZodIntegerTyped[uint16, uint16]
CoercedUint16 creates a uint16 schema with coercion enabled
func CoercedUint16Ptr ¶ added in v0.3.0
func CoercedUint16Ptr(params ...any) *ZodIntegerTyped[uint16, *uint16]
CoercedUint16Ptr creates a *uint16 schema with coercion enabled
func CoercedUint32 ¶ added in v0.2.1
func CoercedUint32(params ...any) *ZodIntegerTyped[uint32, uint32]
CoercedUint32 creates a uint32 schema with coercion enabled
func CoercedUint32Ptr ¶ added in v0.3.0
func CoercedUint32Ptr(params ...any) *ZodIntegerTyped[uint32, *uint32]
CoercedUint32Ptr creates a *uint32 schema with coercion enabled
func CoercedUint64 ¶ added in v0.2.1
func CoercedUint64(params ...any) *ZodIntegerTyped[uint64, uint64]
CoercedUint64 creates a uint64 schema with coercion enabled
func CoercedUint64Ptr ¶ added in v0.3.0
func CoercedUint64Ptr(params ...any) *ZodIntegerTyped[uint64, *uint64]
CoercedUint64Ptr creates a *uint64 schema with coercion enabled
func CoercedUintPtr ¶ added in v0.3.0
func CoercedUintPtr(params ...any) *ZodIntegerTyped[uint, *uint]
CoercedUintPtr creates a *uint schema with coercion enabled
func Int8Ptr ¶ added in v0.3.0
func Int8Ptr(params ...any) *ZodIntegerTyped[int8, *int8]
Int8Ptr creates a schema for *int8.
func Int16 ¶
func Int16(params ...any) *ZodIntegerTyped[int16, int16]
Int16 creates an int16 schema.
func Int16Ptr ¶ added in v0.3.0
func Int16Ptr(params ...any) *ZodIntegerTyped[int16, *int16]
Int16Ptr creates a schema for *int16.
func Int32 ¶
func Int32(params ...any) *ZodIntegerTyped[int32, int32]
Int32 creates an int32 schema.
func Int32Ptr ¶ added in v0.3.0
func Int32Ptr(params ...any) *ZodIntegerTyped[int32, *int32]
Int32Ptr creates a schema for *int32.
func Int64 ¶
func Int64(params ...any) *ZodIntegerTyped[int64, int64]
Int64 creates an int64 schema.
func Int64Ptr ¶ added in v0.3.0
func Int64Ptr(params ...any) *ZodIntegerTyped[int64, *int64]
Int64Ptr creates a schema for *int64.
func IntPtr ¶ added in v0.3.0
func IntPtr(params ...any) *ZodIntegerTyped[int, *int]
IntPtr creates a schema for *int.
func IntegerTyped ¶ added in v0.3.0
func IntegerTyped[T IntegerConstraint](params ...any) *ZodIntegerTyped[T, T]
IntegerTyped creates a generic integer schema with automatic type inference. It automatically determines the appropriate type code based on the generic type parameter. Usage: IntegerTyped[int](), IntegerTyped[uint32](), IntegerTyped[int64](), etc.
func Rune ¶
func Rune(params ...any) *ZodIntegerTyped[int32, int32]
Rune creates an int32 schema (alias for rune).
func RunePtr ¶ added in v0.3.0
func RunePtr(params ...any) *ZodIntegerTyped[int32, *int32]
RunePtr creates a schema for *int32 (alias for *rune).
func Uint8Ptr ¶ added in v0.3.0
func Uint8Ptr(params ...any) *ZodIntegerTyped[uint8, *uint8]
Uint8Ptr creates a schema for *uint8.
func Uint16 ¶
func Uint16(params ...any) *ZodIntegerTyped[uint16, uint16]
Uint16 creates a uint16 schema.
func Uint16Ptr ¶ added in v0.3.0
func Uint16Ptr(params ...any) *ZodIntegerTyped[uint16, *uint16]
Uint16Ptr creates a schema for *uint16.
func Uint32 ¶
func Uint32(params ...any) *ZodIntegerTyped[uint32, uint32]
Uint32 creates a uint32 schema.
func Uint32Ptr ¶ added in v0.3.0
func Uint32Ptr(params ...any) *ZodIntegerTyped[uint32, *uint32]
Uint32Ptr creates a schema for *uint32.
func Uint64 ¶
func Uint64(params ...any) *ZodIntegerTyped[uint64, uint64]
Uint64 creates a uint64 schema.
func Uint64Ptr ¶ added in v0.3.0
func Uint64Ptr(params ...any) *ZodIntegerTyped[uint64, *uint64]
Uint64Ptr creates a schema for *uint64.
func UintPtr ¶ added in v0.3.0
func UintPtr(params ...any) *ZodIntegerTyped[uint, *uint]
UintPtr creates a schema for *uint.
func (*ZodIntegerTyped[T, R]) Check ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodIntegerTyped[T, R]
Check adds a custom validation function for integer schemas that can push multiple issues.
func (*ZodIntegerTyped[T, R]) CloneFrom ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) CloneFrom(source any)
CloneFrom copies configuration from another schema
func (*ZodIntegerTyped[T, R]) Coerce ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Coerce(input any) (any, bool)
Coerce implements Coercible interface for integer type conversion
func (*ZodIntegerTyped[T, R]) Default ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Default(v int64) *ZodIntegerTyped[T, R]
Default keeps the current generic type T.
func (*ZodIntegerTyped[T, R]) DefaultFunc ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) DefaultFunc(fn func() int64) *ZodIntegerTyped[T, R]
DefaultFunc keeps the current generic type T.
func (*ZodIntegerTyped[T, R]) GetInternals ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodIntegerTyped[T, R]) Gt ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Gt(value int64, params ...any) *ZodIntegerTyped[T, R]
Gt adds greater than validation (exclusive)
func (*ZodIntegerTyped[T, R]) Gte ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Gte(value int64, params ...any) *ZodIntegerTyped[T, R]
Gte adds greater than or equal validation (inclusive)
func (*ZodIntegerTyped[T, R]) IsNilable ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) IsNilable() bool
IsNilable returns true if this schema accepts nil values
func (*ZodIntegerTyped[T, R]) IsOptional ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) IsOptional() bool
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodIntegerTyped[T, R]) Lt ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Lt(value int64, params ...any) *ZodIntegerTyped[T, R]
Lt adds less than validation (exclusive)
func (*ZodIntegerTyped[T, R]) Lte ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Lte(value int64, params ...any) *ZodIntegerTyped[T, R]
Lte adds less than or equal validation (inclusive)
func (*ZodIntegerTyped[T, R]) Max ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Max(maximum int64, params ...any) *ZodIntegerTyped[T, R]
Max adds maximum value validation (alias for Lte)
func (*ZodIntegerTyped[T, R]) Meta ¶ added in v0.3.1
func (z *ZodIntegerTyped[T, R]) Meta(meta core.GlobalMeta) *ZodIntegerTyped[T, R]
Meta stores metadata for this integer schema in the global registry.
func (*ZodIntegerTyped[T, R]) Min ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Min(minimum int64, params ...any) *ZodIntegerTyped[T, R]
Min adds minimum value validation (alias for Gte)
func (*ZodIntegerTyped[T, R]) MultipleOf ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) MultipleOf(value int64, params ...any) *ZodIntegerTyped[T, R]
MultipleOf adds multiple of validation
func (*ZodIntegerTyped[T, R]) MustParse ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse is the type-safe variant that panics on error.
func (*ZodIntegerTyped[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodIntegerTyped[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
Example usage:
schema := gozod.Int().Min(0).Max(100) result := schema.MustStrictParse(42) // ✅ int → int result := schema.MustStrictParse(&num) // ❌ compile error
func (*ZodIntegerTyped[T, R]) Negative ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Negative(params ...any) *ZodIntegerTyped[T, R]
Negative adds negative number validation (< 0)
func (*ZodIntegerTyped[T, R]) Nilable ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Nilable() *ZodIntegerTyped[T, *T]
Nilable returns a schema that accepts the base type T or nil, with constraint type *T.
func (*ZodIntegerTyped[T, R]) NonNegative ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) NonNegative(params ...any) *ZodIntegerTyped[T, R]
NonNegative adds non-negative number validation (>= 0, alias for nonnegative)
func (*ZodIntegerTyped[T, R]) NonOptional ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) NonOptional() *ZodIntegerTyped[T, T]
NonOptional removes optional flag and returns value constraint (T). It is the counterpart of Optional() when you need to revert a previously optional schema back to a required field while keeping strong type safety.
func (*ZodIntegerTyped[T, R]) NonPositive ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) NonPositive(params ...any) *ZodIntegerTyped[T, R]
NonPositive adds non-positive number validation (<= 0, alias for nonpositive)
func (*ZodIntegerTyped[T, R]) Nullish ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Nullish() *ZodIntegerTyped[T, *T]
Nullish combines optional and nilable modifiers for maximum flexibility.
func (*ZodIntegerTyped[T, R]) Optional ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Optional() *ZodIntegerTyped[T, *T]
Optional returns a schema that accepts the base type T or nil, with constraint type *T.
func (*ZodIntegerTyped[T, R]) Overwrite ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Overwrite(transform func(T) T, params ...any) *ZodIntegerTyped[T, R]
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodIntegerTyped[T, R]) Parse ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse returns a value that matches the constraint type R with full type safety.
func (*ZodIntegerTyped[T, R]) ParseAny ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodIntegerTyped[T, R]) Pipe ¶ added in v0.3.0
Pipe creates a pipeline using the WrapFn pattern. Instead of using adapter structures, this creates a target function that handles type conversion.
func (*ZodIntegerTyped[T, R]) Positive ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Positive(params ...any) *ZodIntegerTyped[T, R]
Positive adds positive number validation (> 0)
func (*ZodIntegerTyped[T, R]) Prefault ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Prefault(v int64) *ZodIntegerTyped[T, R]
Prefault keeps the current generic type T.
func (*ZodIntegerTyped[T, R]) PrefaultFunc ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) PrefaultFunc(fn func() R) *ZodIntegerTyped[T, R]
PrefaultFunc keeps the current generic type R.
func (*ZodIntegerTyped[T, R]) Refine ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Refine(fn func(T) bool, params ...any) *ZodIntegerTyped[T, R]
Refine applies type-safe validation using the base type T instead of constraint type T. The callback will be executed even when the value is nil (for pointer schemas) to align with Zod v4 semantics.
func (*ZodIntegerTyped[T, R]) RefineAny ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodIntegerTyped[T, R]
RefineAny adds flexible custom validation logic
func (*ZodIntegerTyped[T, R]) Safe ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Safe(params ...any) *ZodIntegerTyped[T, R]
Safe adds safe integer validation (within JavaScript safe integer range)
func (*ZodIntegerTyped[T, R]) Step ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Step(step int64, params ...any) *ZodIntegerTyped[T, R]
Step adds step validation (alias for MultipleOf to match Zod)
func (*ZodIntegerTyped[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodIntegerTyped[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type R.
Example usage:
schema := gozod.Int()
result, err := schema.StrictParse(42) // ✅ int → int
result, err := schema.StrictParse(&num) // ❌ compile error
result, err := schema.StrictParse("42") // ❌ compile error
func (*ZodIntegerTyped[T, R]) Transform ¶ added in v0.3.0
func (z *ZodIntegerTyped[T, R]) Transform(fn func(int64, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using the WrapFn pattern. Integer types implement direct extraction of int64 values for transformation.
type ZodIntersection ¶
ZodIntersection represents an intersection validation schema with dual generic parameters T = base type (any), R = constraint type (any or *any)
func Intersection ¶
func Intersection(left, right any, args ...any) *ZodIntersection[any, any]
Intersection creates intersection schema that validates with both schemas - returns value constraint
func IntersectionPtr ¶ added in v0.3.0
func IntersectionPtr(left, right any, args ...any) *ZodIntersection[any, *any]
IntersectionPtr creates intersection schema that validates with both schemas - returns pointer constraint
func IntersectionTyped ¶ added in v0.3.0
func IntersectionTyped[T any, R any](left, right any, args ...any) *ZodIntersection[T, R]
IntersectionTyped creates typed intersection schema with generic constraints
func (*ZodIntersection[T, R]) CloneFrom ¶
func (z *ZodIntersection[T, R]) CloneFrom(source any)
CloneFrom copies configuration from another schema
func (*ZodIntersection[T, R]) Default ¶
func (z *ZodIntersection[T, R]) Default(v T) *ZodIntersection[T, R]
Default preserves current constraint type R
func (*ZodIntersection[T, R]) DefaultFunc ¶
func (z *ZodIntersection[T, R]) DefaultFunc(fn func() T) *ZodIntersection[T, R]
DefaultFunc preserves current constraint type R
func (*ZodIntersection[T, R]) GetInternals ¶
func (z *ZodIntersection[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodIntersection[T, R]) IsNilable ¶ added in v0.3.0
func (z *ZodIntersection[T, R]) IsNilable() bool
IsNilable returns true if this schema accepts nil values
func (*ZodIntersection[T, R]) IsOptional ¶ added in v0.3.0
func (z *ZodIntersection[T, R]) IsOptional() bool
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodIntersection[T, R]) Left ¶
func (z *ZodIntersection[T, R]) Left() core.ZodSchema
Left returns the left schema of the intersection
func (*ZodIntersection[T, R]) Meta ¶ added in v0.3.1
func (z *ZodIntersection[T, R]) Meta(meta core.GlobalMeta) *ZodIntersection[T, R]
Meta stores metadata for this intersection schema.
func (*ZodIntersection[T, R]) MustParse ¶
func (z *ZodIntersection[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodIntersection[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodIntersection[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodIntersection[T, R]) Nilable ¶
func (z *ZodIntersection[T, R]) Nilable() *ZodIntersection[T, *T]
Nilable makes the intersection nilable and returns pointer constraint
func (*ZodIntersection[T, R]) NonOptional ¶ added in v0.3.0
func (z *ZodIntersection[T, R]) NonOptional() *ZodIntersection[T, T]
NonOptional removes Optional flag and enforces non-nil value (T).
func (*ZodIntersection[T, R]) Nullish ¶
func (z *ZodIntersection[T, R]) Nullish() *ZodIntersection[T, *T]
Nullish combines optional and nilable modifiers
func (*ZodIntersection[T, R]) Optional ¶
func (z *ZodIntersection[T, R]) Optional() *ZodIntersection[T, *T]
Optional makes the intersection optional and returns pointer constraint
func (*ZodIntersection[T, R]) Parse ¶
func (z *ZodIntersection[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using engine.ParseComplex for unified Default/Prefault handling
func (*ZodIntersection[T, R]) ParseAny ¶ added in v0.3.0
func (z *ZodIntersection[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodIntersection[T, R]) Pipe ¶
Pipe creates validation pipeline to another schema using WrapFn pattern
func (*ZodIntersection[T, R]) Prefault ¶
func (z *ZodIntersection[T, R]) Prefault(v T) *ZodIntersection[T, R]
Prefault provides fallback values on validation failure
func (*ZodIntersection[T, R]) PrefaultFunc ¶
func (z *ZodIntersection[T, R]) PrefaultFunc(fn func() T) *ZodIntersection[T, R]
PrefaultFunc keeps current generic type R.
func (*ZodIntersection[T, R]) Refine ¶
func (z *ZodIntersection[T, R]) Refine(fn func(R) bool, params ...any) *ZodIntersection[T, R]
Refine applies type-safe validation with constraint type R
func (*ZodIntersection[T, R]) RefineAny ¶
func (z *ZodIntersection[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodIntersection[T, R]
RefineAny provides flexible validation without type conversion
func (*ZodIntersection[T, R]) Right ¶
func (z *ZodIntersection[T, R]) Right() core.ZodSchema
Right returns the right schema of the intersection
func (*ZodIntersection[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodIntersection[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse validates the input using strict parsing rules
func (*ZodIntersection[T, R]) Transform ¶
func (z *ZodIntersection[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform creates type-safe transformation pipeline using WrapFn pattern
type ZodIntersectionDef ¶
type ZodIntersectionDef struct {
core.ZodTypeDef
Left core.ZodSchema // Left schema using unified interface
Right core.ZodSchema // Right schema using unified interface
}
ZodIntersectionDef defines the schema definition for intersection validation
type ZodIntersectionInternals ¶
type ZodIntersectionInternals struct {
core.ZodTypeInternals
Def *ZodIntersectionDef // Schema definition reference
Left core.ZodSchema // Left schema for runtime validation
Right core.ZodSchema // Right schema for runtime validation
}
ZodIntersectionInternals contains intersection validator internal state
type ZodIso ¶ added in v0.3.0
type ZodIso[T IsoConstraint] struct{ *ZodString[T] }
func IsoDatePtr ¶ added in v0.3.0
func IsoDateTime ¶ added in v0.3.0
func IsoDateTimePtr ¶ added in v0.3.0
func IsoDateTimeTyped ¶ added in v0.3.0
func IsoDateTimeTyped[T IsoConstraint](params ...any) *ZodIso[T]
func IsoDateTyped ¶ added in v0.3.0
func IsoDateTyped[T IsoConstraint](params ...any) *ZodIso[T]
func IsoDuration ¶ added in v0.3.0
func IsoDurationPtr ¶ added in v0.3.0
func IsoDurationTyped ¶ added in v0.3.0
func IsoDurationTyped[T IsoConstraint](params ...any) *ZodIso[T]
func IsoTimePtr ¶ added in v0.3.0
func IsoTimeTyped ¶ added in v0.3.0
func IsoTimeTyped[T IsoConstraint](params ...any) *ZodIso[T]
func IsoTyped ¶ added in v0.3.0
func IsoTyped[T IsoConstraint](params ...any) *ZodIso[T]
func (*ZodIso[T]) DateTime ¶ added in v0.3.0
func (z *ZodIso[T]) DateTime(opts ...IsoDatetimeOptions) *ZodIso[T]
func (*ZodIso[T]) DefaultFunc ¶ added in v0.3.0
func (*ZodIso[T]) GetInternals ¶ added in v0.3.0
func (z *ZodIso[T]) GetInternals() *core.ZodTypeInternals
----------------------------------------------------------------------------- Proxy GetInternals -----------------------------------------------------------------------------
func (*ZodIso[T]) Min ¶ added in v0.3.0
Range validation using lexicographic comparison (perfect for ISO 8601 strings).
func (*ZodIso[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodIso[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodIso[T]) PrefaultFunc ¶ added in v0.3.0
func (*ZodIso[T]) StrictParse ¶ added in v0.4.0
func (z *ZodIso[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
func (*ZodIso[T]) Time ¶ added in v0.3.0
func (z *ZodIso[T]) Time(opts ...IsoTimeOptions) *ZodIso[T]
type ZodJWT ¶ added in v0.3.0
type ZodJWT[T StringConstraint] struct{ *ZodString[T] }
func JWT ¶ added in v0.3.0
JWT creates a JWT token validation schema Supports various parameter combinations:
JWT() - basic JWT structure validation
JWT("error message") - basic validation with custom error message
JWT(JWTOptions{Algorithm: "HS256"}) - with algorithm constraint
JWT(options, "error message") - options with error message
JWT(options, core.SchemaParams{Description: "JWT"}) - options with schema params
func JWTTyped ¶ added in v0.3.0
func JWTTyped[T StringConstraint](params ...any) *ZodJWT[T]
JWTTyped creates a JWT token validation schema with specific type
func (*ZodJWT[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodJWT[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodJWT[T]) StrictParse ¶ added in v0.4.0
func (z *ZodJWT[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodKSUID ¶ added in v0.3.0
type ZodKSUID[T StringConstraint] struct{ *ZodString[T] }
func (*ZodKSUID[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodKSUID[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodKSUID[T]) StrictParse ¶ added in v0.4.0
func (z *ZodKSUID[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodLazy ¶
type ZodLazy[T LazyConstraint] struct { // contains filtered or unexported fields }
ZodLazy represents a lazy validation schema for recursive type definitions
func LazyAny ¶ added in v0.3.0
LazyAny creates a lazy schema that defers evaluation until needed, enabling recursive type definitions
func LazyTyped ¶ added in v0.3.0
func LazyTyped[T LazyConstraint](getter func() any, params ...any) *ZodLazy[T]
LazyTyped is the underlying generic function for creating lazy schemas
func (*ZodLazy[T]) Coerce ¶
Coerce implements Coercible interface - lazy schemas delegate to inner schema
func (*ZodLazy[T]) DefaultFunc ¶
DefaultFunc preserves the current generic type T
func (*ZodLazy[T]) GetInternals ¶
func (z *ZodLazy[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodLazy[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodLazy[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodLazy[T]) Meta ¶ added in v0.3.1
func (z *ZodLazy[T]) Meta(meta core.GlobalMeta) *ZodLazy[T]
Meta stores metadata for this lazy schema.
func (*ZodLazy[T]) MustParse ¶
func (z *ZodLazy[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the type-safe variant that panics on error
func (*ZodLazy[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodLazy[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodLazy[T]) NonOptional ¶ added in v0.3.0
NonOptional removes Optional flag and enforces non-nil value (any).
func (*ZodLazy[T]) Parse ¶
func (z *ZodLazy[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse validates and returns the parsed value using lazy evaluation
func (*ZodLazy[T]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodLazy[T]) PrefaultFunc ¶
PrefaultFunc preserves the current generic type T
func (*ZodLazy[T]) StrictParse ¶ added in v0.4.0
func (z *ZodLazy[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodLazyDef ¶
type ZodLazyDef struct {
core.ZodTypeDef
Getter func() any // Schema getter function that returns any schema type
}
ZodLazyDef defines the configuration for lazy validation
type ZodLazyInternals ¶
type ZodLazyInternals struct {
core.ZodTypeInternals
Def *ZodLazyDef // Schema definition
Getter func() any // Schema getter function that returns any schema type
InnerType core.ZodType[any] // Cached inner schema (converted to interface)
Cached bool // Whether inner schema is cached
}
ZodLazyInternals contains lazy validator internal state
type ZodLazyTyped ¶ added in v0.3.0
type ZodLazyTyped[S ZodSchemaType] struct { *ZodLazy[any] // contains filtered or unexported fields }
ZodLazyTyped is a type-safe wrapper that preserves the inner schema type
func Lazy ¶
func Lazy[S ZodSchemaType](getter func() S, params ...any) *ZodLazyTyped[S]
Lazy creates a type-safe lazy schema with compile-time type checking. This allows for syntax like: Lazy[*ZodString[string]](func() *ZodString[string] { return String().Min(3) })
func (*ZodLazyTyped[S]) Default ¶ added in v0.3.0
func (z *ZodLazyTyped[S]) Default(v any) *ZodLazyTyped[S]
Default provides a default value for the lazy schema
func (*ZodLazyTyped[S]) GetInnerSchema ¶ added in v0.3.0
func (z *ZodLazyTyped[S]) GetInnerSchema() S
GetInnerSchema returns the inner schema with its original type
func (*ZodLazyTyped[S]) MustParse ¶ added in v0.3.0
func (z *ZodLazyTyped[S]) MustParse(input any, ctx ...*core.ParseContext) any
MustParse is the type-safe variant that panics on error
func (*ZodLazyTyped[S]) Nilable ¶ added in v0.3.0
func (z *ZodLazyTyped[S]) Nilable() *ZodLazy[*any]
Nilable creates a nilable version
func (*ZodLazyTyped[S]) NonOptional ¶ added in v0.3.0
func (z *ZodLazyTyped[S]) NonOptional() *ZodLazy[any]
NonOptional removes Optional flag and enforces non-nil value.
func (*ZodLazyTyped[S]) Optional ¶ added in v0.3.0
func (z *ZodLazyTyped[S]) Optional() *ZodLazy[*any]
Optional creates an optional version
func (*ZodLazyTyped[S]) Parse ¶ added in v0.3.0
func (z *ZodLazyTyped[S]) Parse(input any, ctx ...*core.ParseContext) (any, error)
Parse validates and returns the parsed value with type safety
func (*ZodLazyTyped[S]) Refine ¶ added in v0.3.0
func (z *ZodLazyTyped[S]) Refine(fn func(any) bool, params ...any) *ZodLazyTyped[S]
Refine applies custom validation with type safety
type ZodLiteral ¶
type ZodLiteral[T comparable, R any] struct { // contains filtered or unexported fields }
func Literal ¶
func Literal[T comparable](value T, params ...any) *ZodLiteral[T, T]
func LiteralOf ¶ added in v0.3.0
func LiteralOf[T comparable](values []T, params ...any) *ZodLiteral[T, T]
func LiteralPtr ¶ added in v0.3.0
func LiteralPtr[T comparable](value T, params ...any) *ZodLiteral[T, *T]
LiteralPtr creates a literal schema for a single value with a pointer return type
func LiteralPtrOf ¶ added in v0.3.0
func LiteralPtrOf[T comparable](values []T, params ...any) *ZodLiteral[T, *T]
LiteralPtrOf creates a multi-value literal schema with a pointer return type
func LiteralTyped ¶ added in v0.3.0
func LiteralTyped[T comparable, R any](value T, params ...any) *ZodLiteral[T, R]
func (*ZodLiteral[T, R]) Contains ¶ added in v0.3.0
func (z *ZodLiteral[T, R]) Contains(v T) bool
Contains checks if a given value is one of the allowed literal values.
func (*ZodLiteral[T, R]) Default ¶
func (z *ZodLiteral[T, R]) Default(v T) *ZodLiteral[T, R]
Default sets a default value for the schema.
func (*ZodLiteral[T, R]) DefaultFunc ¶
func (z *ZodLiteral[T, R]) DefaultFunc(fn func() T) *ZodLiteral[T, R]
func (*ZodLiteral[T, R]) GetInternals ¶
func (z *ZodLiteral[T, R]) GetInternals() *core.ZodTypeInternals
func (*ZodLiteral[T, R]) IsNilable ¶ added in v0.3.0
func (z *ZodLiteral[T, R]) IsNilable() bool
func (*ZodLiteral[T, R]) IsOptional ¶ added in v0.3.0
func (z *ZodLiteral[T, R]) IsOptional() bool
func (*ZodLiteral[T, R]) MustParse ¶
func (z *ZodLiteral[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
func (*ZodLiteral[T, R]) MustParseAny ¶ added in v0.3.1
func (z *ZodLiteral[T, R]) MustParseAny(input any, ctx ...*core.ParseContext) any
func (*ZodLiteral[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodLiteral[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
MustStrictParse is the strict mode variant that panics on error.
func (*ZodLiteral[T, R]) Nilable ¶
func (z *ZodLiteral[T, R]) Nilable() *ZodLiteral[T, *T]
Nilable returns a new schema that allows the value to be nil. It changes the constraint type from R to *T.
func (*ZodLiteral[T, R]) Nullish ¶
func (z *ZodLiteral[T, R]) Nullish() *ZodLiteral[T, *T]
Nullish combines optional and nilable modifiers.
func (*ZodLiteral[T, R]) Optional ¶
func (z *ZodLiteral[T, R]) Optional() *ZodLiteral[T, *T]
Optional returns a new schema that allows the value to be nil. It changes the constraint type from R to *T.
func (*ZodLiteral[T, R]) Parse ¶
func (z *ZodLiteral[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates the input value and returns a typed result. It leverages engine.ParsePrimitive so that all modifiers, checks, and transforms work consistently across the code-base.
func (*ZodLiteral[T, R]) ParseAny ¶ added in v0.3.0
func (z *ZodLiteral[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny is a zero-overhead wrapper around Parse and is used by reflection-based callers that don’t know the concrete type parameters at compile-time.
func (*ZodLiteral[T, R]) Prefault ¶
func (z *ZodLiteral[T, R]) Prefault(v T) *ZodLiteral[T, R]
Prefault sets a fallback value if parsing fails.
func (*ZodLiteral[T, R]) PrefaultFunc ¶
func (z *ZodLiteral[T, R]) PrefaultFunc(fn func() T) *ZodLiteral[T, R]
func (*ZodLiteral[T, R]) Refine ¶
func (z *ZodLiteral[T, R]) Refine(fn func(T) bool, params ...any) *ZodLiteral[T, R]
Refine adds a custom validation check to the schema.
func (*ZodLiteral[T, R]) RefineAny ¶
func (z *ZodLiteral[T, R]) RefineAny(fn func(any) bool, params ...any) *ZodLiteral[T, R]
RefineAny adds a custom validation check to the schema, accepting `any`.
func (*ZodLiteral[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodLiteral[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching.
func (*ZodLiteral[T, R]) Value ¶
func (z *ZodLiteral[T, R]) Value() T
Value returns the first literal value. Useful for single-value literals.
func (*ZodLiteral[T, R]) Values ¶ added in v0.3.0
func (z *ZodLiteral[T, R]) Values() []T
Values returns all literal values.
type ZodLiteralDef ¶
type ZodLiteralDef[T comparable] struct { core.ZodTypeDef Values []T }
ZodLiteralDef defines the structure of a literal schema
type ZodLiteralInternals ¶
type ZodLiteralInternals[T comparable] struct { core.ZodTypeInternals Def *ZodLiteralDef[T] }
ZodLiteralInternals holds the internal state of a literal schema
type ZodMap ¶
ZodMap represents a type-safe map validation schema with dual generic parameters T = base type (map[any]any), R = constraint type (map[any]any or *map[any]any)
func MapPtr ¶ added in v0.3.0
MapPtr creates map schema with key and value validation - returns pointer constraint
func (*ZodMap[T, R]) Check ¶
func (z *ZodMap[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodMap[T, R]
Check adds a custom validation function that can report multiple issues for map schema.
func (*ZodMap[T, R]) DefaultFunc ¶
DefaultFunc preserves current constraint type R
func (*ZodMap[T, R]) GetInternals ¶
func (z *ZodMap[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodMap[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodMap[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodMap[T, R]) Meta ¶ added in v0.3.1
func (z *ZodMap[T, R]) Meta(meta core.GlobalMeta) *ZodMap[T, R]
Meta stores metadata for this map schema.
func (*ZodMap[T, R]) MustParse ¶
func (z *ZodMap[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodMap[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodMap[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure
func (*ZodMap[T, R]) NonOptional ¶ added in v0.3.0
NonOptional removes Optional flag to require map value and returns base constraint type.
func (*ZodMap[T, R]) Optional ¶
Optional creates optional map schema that returns pointer constraint
func (*ZodMap[T, R]) Overwrite ¶ added in v0.3.0
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodMap[T, R]) Parse ¶
func (z *ZodMap[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using direct validation approach Parse validates input using map-specific parsing logic with engine.ParseComplex
func (*ZodMap[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodMap[T, R]) Pipe ¶
Pipe creates a pipeline using the WrapFn pattern. Instead of using adapter structures, this creates a target function that handles type conversion. Map types implement direct extraction of T values for transformation.
func (*ZodMap[T, R]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodMap[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodMap[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse validates input with compile-time type safety
func (*ZodMap[T, R]) Transform ¶
func (z *ZodMap[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using the WrapFn pattern. Map types implement direct extraction of T values for transformation.
type ZodMapDef ¶
type ZodMapDef struct {
core.ZodTypeDef
KeyType any // The key schema (type-erased for flexibility)
ValueType any // The value schema (type-erased for flexibility)
}
ZodMapDef defines the schema definition for map validation
type ZodMapInternals ¶
type ZodMapInternals struct {
core.ZodTypeInternals
Def *ZodMapDef // Schema definition reference
KeyType any // Key schema for runtime validation
ValueType any // Value schema for runtime validation
}
ZodMapInternals contains the internal state for map schema
type ZodNanoID ¶ added in v0.3.0
type ZodNanoID[T StringConstraint] struct{ *ZodString[T] }
func (*ZodNanoID[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodNanoID[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodNanoID[T]) StrictParse ¶ added in v0.4.0
func (z *ZodNanoID[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodNever ¶
ZodNever represents a never validation schema that always fails validation
func NeverPtr ¶ added in v0.3.0
NeverPtr creates never schema that always fails validation - returns pointer constraint
func NeverTyped ¶ added in v0.3.0
NeverTyped creates typed never schema with generic constraints
func (*ZodNever[T, R]) Default ¶ added in v0.3.0
Default sets a default value - preserves current constraint type
func (*ZodNever[T, R]) DefaultFunc ¶ added in v0.3.0
DefaultFunc sets a default value function - preserves current constraint type
func (*ZodNever[T, R]) GetInternals ¶
func (z *ZodNever[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal configuration
func (*ZodNever[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodNever[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodNever[T, R]) Meta ¶ added in v0.3.1
func (z *ZodNever[T, R]) Meta(meta core.GlobalMeta) *ZodNever[T, R]
Meta stores metadata for this never schema.
func (*ZodNever[T, R]) MustParse ¶
func (z *ZodNever[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodNever[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodNever[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
MustStrictParse provides compile-time type safety and panics on validation failure. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type R.
func (*ZodNever[T, R]) Nilable ¶
Nilable makes the never nilable (allows nil) - returns pointer constraint
func (*ZodNever[T, R]) Nullish ¶
Nullish makes the never both optional and nilable - returns pointer constraint
func (*ZodNever[T, R]) Optional ¶
Optional makes the never optional (allows nil) - returns pointer constraint
func (*ZodNever[T, R]) Parse ¶
func (z *ZodNever[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates the input value with never logic using unified engine parsing
func (*ZodNever[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodNever[T, R]) Pipe ¶
Pipe creates a validation pipeline using WrapFn pattern (first stage will be Never)
func (*ZodNever[T, R]) Prefault ¶ added in v0.3.0
Prefault sets a prefault (fallback) value - preserves current constraint type
func (*ZodNever[T, R]) PrefaultFunc ¶ added in v0.3.0
PrefaultFunc keeps the current generic type R.
func (*ZodNever[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodNever[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type R.
func (*ZodNever[T, R]) Transform ¶
func (z *ZodNever[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using WrapFn pattern (note: rarely called due to Never's nature)
type ZodNeverDef ¶
type ZodNeverDef struct {
core.ZodTypeDef
}
ZodNeverDef defines the structure for never validation schemas
type ZodNeverInternals ¶
type ZodNeverInternals struct {
core.ZodTypeInternals
Def *ZodNeverDef // Schema definition
}
ZodNeverInternals provides internal state for never schemas
type ZodNil ¶
type ZodNil[T any] struct { // contains filtered or unexported fields }
ZodNil represents a nil validation schema with type safety
func Nil ¶
Nil creates a nil schema following Zod TypeScript v4 pattern Usage:
Nil() // no parameters
Nil("custom error") // string shorthand
Nil(SchemaParams{...}) // full parameters
func NilTyped ¶ added in v0.3.0
NilTyped is the underlying generic function for creating nil schemas allowing for explicit type parameterization
func (*ZodNil[T]) DefaultFunc ¶
DefaultFunc keeps the current generic type T.
func (*ZodNil[T]) GetInternals ¶
func (z *ZodNil[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodNil[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodNil[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodNil[T]) Meta ¶ added in v0.3.1
func (z *ZodNil[T]) Meta(meta core.GlobalMeta) *ZodNil[T]
Meta stores metadata for this nil schema.
func (*ZodNil[T]) MustParse ¶
func (z *ZodNil[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the type-safe variant that panics on error.
func (*ZodNil[T]) MustParseAny ¶ added in v0.4.0
func (z *ZodNil[T]) MustParseAny(input any, ctx ...*core.ParseContext) any
MustParseAny is the any-type variant that panics on error.
func (*ZodNil[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodNil[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse provides compile-time type safety and panics on validation failure. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodNil[T]) Optional ¶
Optional always returns *any because the optional value may be nil or missing.
func (*ZodNil[T]) Parse ¶
func (z *ZodNil[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns a value that matches the generic type T with full type safety Nil type uses the standard ParsePrimitive with custom validator and converter
func (*ZodNil[T]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodNil[T]) PrefaultFunc ¶
PrefaultFunc keeps the current generic type T.
func (*ZodNil[T]) Refine ¶
Refine applies a custom validation function that matches the schema's output type T. The callback will be executed even when the value is nil (for *any schemas) to align with Zod v4 semantics.
func (*ZodNil[T]) StrictParse ¶ added in v0.4.0
func (z *ZodNil[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodNilDef ¶
type ZodNilDef struct {
core.ZodTypeDef
}
ZodNilDef defines the configuration for nil validation
type ZodNilInternals ¶
type ZodNilInternals struct {
core.ZodTypeInternals
Def *ZodNilDef // Schema definition
}
ZodNilInternals contains nil validator internal state
type ZodObject ¶
ZodObject represents a type-safe object validation schema
func LooseObject ¶
LooseObject creates loose object schema with default types
func LooseObjectPtr ¶ added in v0.3.0
func LooseObjectPtr(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, *map[string]any]
LooseObjectPtr creates loose object schema with pointer constraint
func ObjectTyped ¶ added in v0.3.0
ObjectTyped creates a typed object schema with explicit type parameters
func StrictObject ¶
func StrictObject(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, map[string]any]
StrictObject creates strict object schema with default types
func StrictObjectPtr ¶ added in v0.3.0
func StrictObjectPtr(shape core.ObjectSchema, params ...any) *ZodObject[map[string]any, *map[string]any]
StrictObjectPtr creates strict object schema with pointer constraint
func (*ZodObject[T, R]) Check ¶
func (z *ZodObject[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodObject[T, R]
Check adds a custom validation function that can report multiple issues for object schema.
func (*ZodObject[T, R]) DefaultFunc ¶
DefaultFunc preserves current type
func (*ZodObject[T, R]) Extend ¶
func (z *ZodObject[T, R]) Extend(augmentation core.ObjectSchema, params ...any) *ZodObject[T, R]
Extend creates a new object by extending with additional fields
func (*ZodObject[T, R]) GetCatchall ¶ added in v0.3.1
GetCatchall returns the catchall schema for JSON Schema conversion
func (*ZodObject[T, R]) GetInternals ¶
func (z *ZodObject[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodObject[T, R]) GetUnknownKeys ¶ added in v0.3.1
func (z *ZodObject[T, R]) GetUnknownKeys() ObjectMode
GetUnknownKeys returns the unknown keys handling mode for JSON Schema conversion
func (*ZodObject[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodObject[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodObject[T, R]) Meta ¶ added in v0.3.1
func (z *ZodObject[T, R]) Meta(meta core.GlobalMeta) *ZodObject[T, R]
Meta attaches GlobalMeta to this object schema via the global registry.
func (*ZodObject[T, R]) MustParse ¶
func (z *ZodObject[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodObject[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodObject[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodObject[T, R]) NonOptional ¶ added in v0.3.0
NonOptional removes the optional flag and enforces non-nil value type. It returns a schema whose constraint type is the base value (T), mirroring the behaviour of .Optional().NonOptional() chain in TypeScript Zod.
func (*ZodObject[T, R]) Omit ¶
Omit creates a new object excluding specified keys Non-existent keys are silently ignored to maintain fluent interface design
func (*ZodObject[T, R]) Overwrite ¶ added in v0.3.0
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodObject[T, R]) Parse ¶
func (z *ZodObject[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using object-specific parsing logic with engine.ParseComplex
func (*ZodObject[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodObject[T, R]) Passthrough ¶
Passthrough sets passthrough mode (unknown keys are allowed)
func (*ZodObject[T, R]) Pick ¶
Pick creates a new object with only specified keys Non-existent keys are silently ignored to maintain fluent interface design
func (*ZodObject[T, R]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodObject[T, R]) Properties ¶ added in v0.3.1
func (z *ZodObject[T, R]) Properties() core.ObjectSchema
Properties is an alias for Shape(), returning the object's field schemas. This is included for alignment with documentation and developer convenience.
func (*ZodObject[T, R]) Property ¶ added in v0.3.0
func (z *ZodObject[T, R]) Property(key string, schema core.ZodSchema, params ...any) *ZodObject[T, R]
Property validates a specific property using the provided schema
func (*ZodObject[T, R]) Shape ¶
func (z *ZodObject[T, R]) Shape() core.ObjectSchema
Shape returns the object shape (field schemas)
func (*ZodObject[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodObject[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse validates input with compile-time type safety and enhanced performance. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodObject[T, R]) Transform ¶
func (z *ZodObject[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform creates a type-safe transformation using WrapFn pattern
type ZodObjectDef ¶
type ZodObjectDef struct {
core.ZodTypeDef
Shape core.ObjectSchema // Field schemas
Catchall core.ZodSchema // Schema for unrecognized keys
UnknownKeys ObjectMode // How to handle unknown keys
}
ZodObjectDef defines the schema definition for object validation
type ZodObjectInternals ¶
type ZodObjectInternals struct {
core.ZodTypeInternals
Def *ZodObjectDef // Schema definition reference
Shape core.ObjectSchema // Field schemas for runtime validation
Catchall core.ZodSchema // Catchall schema for unknown fields
UnknownKeys ObjectMode // Validation mode
IsPartial bool // Whether this is a partial object (all fields optional)
PartialExceptions map[string]bool // Fields that should remain required in partial mode
}
ZodObjectInternals contains the internal state for object schema
type ZodRecord ¶
ZodRecord represents a type-safe record validation schema with dual generic parameters T = base type (map[string]any), R = constraint type (map[string]any or *map[string]any)
func PartialRecord ¶
func PartialRecord(keySchema, valueSchema any, paramArgs ...any) *ZodRecord[map[string]any, map[string]any]
PartialRecord creates a record schema that skips exhaustive key checks (equivalent to Zod's partialRecord)
func PartialRecordPtr ¶ added in v0.3.1
func PartialRecordPtr(keySchema, valueSchema any, paramArgs ...any) *ZodRecord[map[string]any, *map[string]any]
PartialRecordPtr variant returning pointer constraint
func Record ¶
func Record(keySchema, valueSchema any, paramArgs ...any) *ZodRecord[map[string]any, map[string]any]
Record creates record schema with key schema and value schema - returns value constraint
func RecordPtr ¶ added in v0.3.0
func RecordPtr(keySchema, valueSchema any, paramArgs ...any) *ZodRecord[map[string]any, *map[string]any]
RecordPtr creates record schema returning pointer constraint
func RecordTyped ¶ added in v0.3.0
RecordTyped creates typed record schema with generic constraints
func (*ZodRecord[T, R]) Check ¶ added in v0.3.0
func (z *ZodRecord[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodRecord[T, R]
Check adds a custom validation function that can report multiple issues for record schema.
func (*ZodRecord[T, R]) DefaultFunc ¶
DefaultFunc preserves current constraint type R
func (*ZodRecord[T, R]) GetInternals ¶
func (z *ZodRecord[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodRecord[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodRecord[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodRecord[T, R]) KeyType ¶ added in v0.3.1
KeyType returns the key schema for this record, which is always a string.
func (*ZodRecord[T, R]) Meta ¶ added in v0.3.1
func (z *ZodRecord[T, R]) Meta(meta core.GlobalMeta) *ZodRecord[T, R]
Meta stores metadata for this record schema.
func (*ZodRecord[T, R]) MustParse ¶
func (z *ZodRecord[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodRecord[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodRecord[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse is the variant that panics on error
func (*ZodRecord[T, R]) NonOptional ¶ added in v0.3.0
NonOptional removes Optional flag and enforces record presence.
func (*ZodRecord[T, R]) Optional ¶
Optional creates optional record schema that returns pointer constraint
func (*ZodRecord[T, R]) Overwrite ¶ added in v0.3.0
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodRecord[T, R]) Parse ¶
func (z *ZodRecord[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using unified ParseComplex API
func (*ZodRecord[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodRecord[T, R]) Pipe ¶
Pipe creates a pipeline using the WrapFn pattern. Instead of using adapter structures, this creates a target function that handles type conversion.
func (*ZodRecord[T, R]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodRecord[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodRecord[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodRecord[T, R]) Transform ¶
func (z *ZodRecord[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using the WrapFn pattern. Record types implement direct extraction of T values for transformation.
type ZodRecordDef ¶
type ZodRecordDef struct {
core.ZodTypeDef
KeyType any // The key schema (type-erased for flexibility)
ValueType any // The value schema (type-erased for flexibility)
}
ZodRecordDef defines the schema definition for record validation
type ZodRecordInternals ¶
type ZodRecordInternals struct {
core.ZodTypeInternals
Def *ZodRecordDef // Schema definition reference
KeyType any // Key schema for runtime validation
ValueType any // Value schema for runtime validation
}
ZodRecordInternals contains the internal state for record schema
type ZodSchemaType ¶ added in v0.3.0
type ZodSchemaType interface {
GetInternals() *core.ZodTypeInternals
}
ZodSchemaType represents any Zod schema type that implements the basic interface
type ZodSlice ¶
ZodSlice represents a type-safe slice validation schema with dual generic parameters T: element type, R: constraint type ([]T or *[]T)
func SlicePtr ¶ added in v0.3.0
SlicePtr creates slice schema with pointer constraint (returns pointer constraint)
func SliceTyped ¶ added in v0.3.0
SliceTyped creates slice schema with explicit constraint type (universal constructor)
func (*ZodSlice[T, R]) Check ¶
func (z *ZodSlice[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodSlice[T, R]
Check adds a custom validation function for slice schema that can push multiple issues.
func (*ZodSlice[T, R]) DefaultFunc ¶
DefaultFunc preserves current constraint type
func (*ZodSlice[T, R]) GetInternals ¶
func (z *ZodSlice[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodSlice[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodSlice[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodSlice[T, R]) Meta ¶ added in v0.3.1
func (z *ZodSlice[T, R]) Meta(meta core.GlobalMeta) *ZodSlice[T, R]
Meta stores metadata for this slice schema in the global registry.
func (*ZodSlice[T, R]) MustParse ¶
func (z *ZodSlice[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodSlice[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodSlice[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodSlice[T, R]) NonOptional ¶ added in v0.3.0
NonOptional removes Optional flag and enforces non-nil slice constraint ([]T).
func (*ZodSlice[T, R]) Nullish ¶
Nullish combines optional and nilable modifiers (always returns pointer constraint)
func (*ZodSlice[T, R]) Optional ¶
Optional creates optional slice schema (always returns pointer constraint)
func (*ZodSlice[T, R]) Overwrite ¶ added in v0.3.0
Overwrite transforms slice value while keeping the same type
func (*ZodSlice[T, R]) Parse ¶
func (z *ZodSlice[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using slice-specific parsing logic with type safety
func (*ZodSlice[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodSlice[T, R]) Pipe ¶
Pipe creates a pipeline using the WrapFn pattern. Instead of using adapter structures, this creates a target function that handles type conversion.
func (*ZodSlice[T, R]) Prefault ¶
Prefault provides fallback values on validation failure (preserves constraint type)
func (*ZodSlice[T, R]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values (preserves constraint type)
func (*ZodSlice[T, R]) Refine ¶
Refine adds type-safe custom validation with automatic constraint type matching
func (*ZodSlice[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodSlice[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodSlice[T, R]) Transform ¶
func (z *ZodSlice[T, R]) Transform(fn func(R, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform applies a transformation function using the WrapFn pattern. Slice types pass the constraint type R directly to transformation functions.
type ZodSliceDef ¶
type ZodSliceDef struct {
core.ZodTypeDef
Element any // The element schema (type-erased for flexibility)
}
ZodSliceDef defines the schema definition for slice validation
type ZodSliceInternals ¶
type ZodSliceInternals[T any] struct { core.ZodTypeInternals Def *ZodSliceDef // Schema definition reference Element any // Element schema for runtime validation }
ZodSliceInternals contains the internal state for slice schema
type ZodString ¶
type ZodString[T StringConstraint] struct { // contains filtered or unexported fields }
ZodString represents a string validation schema with type safety
func CoercedString ¶ added in v0.2.1
CoercedString creates a new string schema with coercion enabled
func CoercedStringPtr ¶ added in v0.3.0
CoercedStringPtr creates a new string schema with pointer type and coercion enabled
func StringTyped ¶ added in v0.3.0
func StringTyped[T StringConstraint](params ...any) *ZodString[T]
StringTyped creates a new string schema with specific type
func (*ZodString[T]) Check ¶ added in v0.3.0
func (z *ZodString[T]) Check(fn func(value T, payload *core.ParsePayload), params ...any) *ZodString[T]
Check adds a custom validation function that can push multiple issues via ParsePayload.
func (*ZodString[T]) DefaultFunc ¶
DefaultFunc keeps the current generic type T.
func (*ZodString[T]) GetInternals ¶
func (z *ZodString[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodString[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodString[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodString[T]) Meta ¶ added in v0.3.1
func (z *ZodString[T]) Meta(meta core.GlobalMeta) *ZodString[T]
Meta stores metadata for this schema in the global registry. This does not clone internals because metadata does not affect validation.
func (*ZodString[T]) MustParse ¶
func (z *ZodString[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the type-safe variant that panics on error.
func (*ZodString[T]) MustParseAny ¶ added in v0.3.1
func (z *ZodString[T]) MustParseAny(input any, ctx ...*core.ParseContext) any
MustParseAny validates the input value and panics on failure
func (*ZodString[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodString[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
func (*ZodString[T]) NonOptional ¶ added in v0.3.0
NonOptional removes the optional flag and returns a new schema with string value type
func (*ZodString[T]) Nullish ¶
Nullish combines optional and nilable modifiers for maximum flexibility
func (*ZodString[T]) Optional ¶
Optional always returns *string because the optional value may be nil.
func (*ZodString[T]) Overwrite ¶ added in v0.3.0
Overwrite applies a transformation function that must return the same type T
func (*ZodString[T]) Parse ¶
func (z *ZodString[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns a value that matches the generic type T with full type safety.
func (*ZodString[T]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodString[T]) PrefaultFunc ¶
PrefaultFunc keeps the current generic type T.
func (*ZodString[T]) Refine ¶
Refine applies a custom validation function that matches the schema's output type T.
func (*ZodString[T]) RegexString ¶ added in v0.3.0
RegexString adds custom regex validation using string pattern (convenience method)
func (*ZodString[T]) StartsWith ¶
StartsWith adds prefix validation
func (*ZodString[T]) StrictParse ¶ added in v0.4.0
func (z *ZodString[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodString[T]) ToLowerCase ¶
ToLowerCase transforms the string to lower case
func (*ZodString[T]) ToUpperCase ¶
ToUpperCase transforms the string to upper case
type ZodStringBool ¶
type ZodStringBool[T StringBoolConstraint] struct { // contains filtered or unexported fields }
ZodStringBool represents a string-to-boolean validation schema with type safety
func CoercedStringBool ¶ added in v0.3.0
func CoercedStringBool(params ...any) *ZodStringBool[bool]
CoercedStringBool creates a coerced stringbool schema
func CoercedStringBoolPtr ¶ added in v0.3.0
func CoercedStringBoolPtr(params ...any) *ZodStringBool[*bool]
CoercedStringBoolPtr creates a coerced stringbool schema for *bool
func StringBool ¶
func StringBool(params ...any) *ZodStringBool[bool]
StringBool creates bool schema with type-inference support
func StringBoolPtr ¶ added in v0.3.0
func StringBoolPtr(params ...any) *ZodStringBool[*bool]
StringBoolPtr creates schema for *bool
func StringBoolTyped ¶ added in v0.3.0
func StringBoolTyped[T StringBoolConstraint](params ...any) *ZodStringBool[T]
StringBoolTyped is the generic constructor for stringbool schemas
func (*ZodStringBool[T]) CloneFrom ¶ added in v0.3.0
func (z *ZodStringBool[T]) CloneFrom(source any)
CloneFrom copies configuration from another schema
func (*ZodStringBool[T]) Coerce ¶
func (z *ZodStringBool[T]) Coerce(input any) (any, bool)
Coerce implements Coercible interface for string-to-bool type conversion
func (*ZodStringBool[T]) Default ¶
func (z *ZodStringBool[T]) Default(v bool) *ZodStringBool[T]
Default preserves current generic type T
func (*ZodStringBool[T]) DefaultFunc ¶
func (z *ZodStringBool[T]) DefaultFunc(fn func() bool) *ZodStringBool[T]
DefaultFunc preserves current generic type T
func (*ZodStringBool[T]) GetInternals ¶
func (z *ZodStringBool[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodStringBool[T]) IsNilable ¶ added in v0.3.0
func (z *ZodStringBool[T]) IsNilable() bool
IsNilable returns true if this schema accepts nil values
func (*ZodStringBool[T]) IsOptional ¶ added in v0.3.0
func (z *ZodStringBool[T]) IsOptional() bool
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodStringBool[T]) Meta ¶ added in v0.3.1
func (z *ZodStringBool[T]) Meta(meta core.GlobalMeta) *ZodStringBool[T]
Meta stores metadata for this stringbool schema.
func (*ZodStringBool[T]) MustParse ¶
func (z *ZodStringBool[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the type-safe variant that panics on error.
func (*ZodStringBool[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodStringBool[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse provides compile-time type safety and panics on validation failure. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodStringBool[T]) Nilable ¶
func (z *ZodStringBool[T]) Nilable() *ZodStringBool[*bool]
Nilable allows nil values, returns pointer type
func (*ZodStringBool[T]) Nullish ¶
func (z *ZodStringBool[T]) Nullish() *ZodStringBool[*bool]
Nullish combines optional and nilable modifiers
func (*ZodStringBool[T]) Optional ¶
func (z *ZodStringBool[T]) Optional() *ZodStringBool[*bool]
Optional always returns *bool for nullable semantics
func (*ZodStringBool[T]) Overwrite ¶ added in v0.3.0
func (z *ZodStringBool[T]) Overwrite(transform func(T) T, params ...any) *ZodStringBool[T]
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodStringBool[T]) Parse ¶
func (z *ZodStringBool[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns a value that matches the generic type T with full type safety.
func (*ZodStringBool[T]) ParseAny ¶ added in v0.3.0
func (z *ZodStringBool[T]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodStringBool[T]) Prefault ¶
func (z *ZodStringBool[T]) Prefault(v string) *ZodStringBool[T]
Prefault provides fallback values on validation failure According to Zod v4 semantics, prefault accepts input type (string) for StringBool
func (*ZodStringBool[T]) PrefaultFunc ¶
func (z *ZodStringBool[T]) PrefaultFunc(fn func() string) *ZodStringBool[T]
PrefaultFunc keeps current generic type T. According to Zod v4 semantics, prefault function returns input type (string) for StringBool
func (*ZodStringBool[T]) Refine ¶
func (z *ZodStringBool[T]) Refine(fn func(T) bool, params ...any) *ZodStringBool[T]
Refine adds type-safe custom validation logic to the stringbool schema
func (*ZodStringBool[T]) RefineAny ¶
func (z *ZodStringBool[T]) RefineAny(fn func(any) bool, params ...any) *ZodStringBool[T]
RefineAny provides flexible validation without type conversion
func (*ZodStringBool[T]) StrictParse ¶ added in v0.4.0
func (z *ZodStringBool[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodStringBool[T]) Transform ¶
func (z *ZodStringBool[T]) Transform(fn func(bool, *core.RefinementContext) (any, error)) *core.ZodTransform[T, any]
Transform creates a type-safe transformation using WrapFn pattern
type ZodStringBoolDef ¶
type ZodStringBoolDef struct {
core.ZodTypeDef
Truthy []string // Truthy string values
Falsy []string // Falsy string values
Case string // "sensitive" or "insensitive"
CustomOptions bool // Whether custom options were provided
}
ZodStringBoolDef defines the configuration for string boolean validation
type ZodStringBoolInternals ¶
type ZodStringBoolInternals struct {
core.ZodTypeInternals
Def *ZodStringBoolDef // Schema definition
Truthy map[string]struct{} // Truthy values set for fast lookup
Falsy map[string]struct{} // Falsy values set for fast lookup
}
ZodStringBoolInternals contains stringbool validator internal state
type ZodStringDef ¶
type ZodStringDef struct {
core.ZodTypeDef
}
ZodStringDef defines the configuration for string validation
type ZodStringInternals ¶
type ZodStringInternals struct {
core.ZodTypeInternals
Def *ZodStringDef // Schema definition
}
ZodStringInternals contains string validator internal state
type ZodStruct ¶
ZodStruct represents a type-safe struct validation schema with dual generic parameters T is the base comparable type, R is the constraint type (T | *T)
func FromStruct ¶ added in v0.5.0
FromStruct creates a ZodStruct schema from struct tags This is a convenience function that uses the tag parsing infrastructure
func FromStructPtr ¶ added in v0.5.0
FromStructPtr creates a ZodStruct schema for pointer types from struct tags
func Struct ¶
Struct creates a struct schema for validating Go struct instances directly Usage: Struct[User]() validates User struct instances Usage: Struct[User](core.StructSchema{...}) validates User with field schemas
func StructPtr ¶ added in v0.3.0
StructPtr creates a struct schema for validating pointer to Go struct instances Usage: StructPtr[User]() validates *User (can be nil) Usage: StructPtr[User](core.StructSchema{...}) validates *User with field schemas
func (*ZodStruct[T, R]) Check ¶ added in v0.3.0
func (z *ZodStruct[T, R]) Check(fn func(value R, payload *core.ParsePayload), params ...any) *ZodStruct[T, R]
Check adds a custom validation function that can report multiple issues for struct schema.
func (*ZodStruct[T, R]) DefaultFunc ¶
DefaultFunc keeps the current generic constraint type R.
func (*ZodStruct[T, R]) Extend ¶
func (z *ZodStruct[T, R]) Extend(augmentation core.StructSchema, params ...any) *ZodStruct[T, R]
Extend creates a new struct by extending with additional field schemas
func (*ZodStruct[T, R]) GetCatchall ¶ added in v0.3.1
GetCatchall returns nil since structs don't support catchall by default
func (*ZodStruct[T, R]) GetInternals ¶
func (z *ZodStruct[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodStruct[T, R]) GetUnknownKeys ¶ added in v0.3.1
GetUnknownKeys returns the unknown keys handling mode for JSON Schema conversion Structs are strict by default (don't allow additional properties)
func (*ZodStruct[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodStruct[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodStruct[T, R]) Meta ¶ added in v0.3.1
func (z *ZodStruct[T, R]) Meta(meta core.GlobalMeta) *ZodStruct[T, R]
Meta stores metadata for this struct schema.
func (*ZodStruct[T, R]) MustParse ¶
func (z *ZodStruct[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodStruct[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodStruct[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodStruct[T, R]) Nilable ¶
Nilable always returns *T constraint because the value may be nil.
func (*ZodStruct[T, R]) NonOptional ¶ added in v0.3.0
NonOptional removes Optional flag and enforces non-nil struct value (T).
func (*ZodStruct[T, R]) Nullish ¶
Nullish combines optional and nilable modifiers for maximum flexibility
func (*ZodStruct[T, R]) Optional ¶
Optional always returns *T constraint because the optional value may be nil.
func (*ZodStruct[T, R]) Overwrite ¶ added in v0.3.0
Overwrite transforms the input value while preserving the original type. Unlike Transform, this method doesn't change the inferred type and returns an instance of the original class. The transformation function is stored as a check, so it doesn't modify the inferred type.
func (*ZodStruct[T, R]) Parse ¶
func (z *ZodStruct[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using struct-specific parsing logic with engine.ParseComplex
func (*ZodStruct[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodStruct[T, R]) PrefaultFunc ¶
PrefaultFunc provides dynamic fallback values
func (*ZodStruct[T, R]) Required ¶ added in v0.4.0
Required makes all fields required (opposite of Partial)
func (*ZodStruct[T, R]) Shape ¶
func (z *ZodStruct[T, R]) Shape() core.StructSchema
Shape returns the struct field schemas for JSON Schema conversion
func (*ZodStruct[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodStruct[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodStruct[T, R]) Transform ¶ added in v0.3.0
func (z *ZodStruct[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform creates a type-safe transformation using WrapFn pattern
type ZodStructDef ¶
type ZodStructDef struct {
core.ZodTypeDef
Shape core.StructSchema // Field schemas for struct validation
}
ZodStructDef defines the schema definition for struct validation
type ZodStructInternals ¶
type ZodStructInternals struct {
core.ZodTypeInternals
Def *ZodStructDef // Schema definition reference
Shape core.StructSchema // Field schemas for runtime validation
IsPartial bool // Whether this is a partial struct (fields can be zero values)
PartialExceptions map[string]bool // Fields that should remain required in partial mode
}
ZodStructInternals contains the internal state for struct schema
type ZodTime ¶ added in v0.3.0
type ZodTime[T TimeConstraint] struct { // contains filtered or unexported fields }
ZodTime represents a time validation schema with type safety
func CoercedTime ¶ added in v0.3.0
CoercedTime creates a time.Time schema with coercion enabled
func CoercedTimePtr ¶ added in v0.3.0
CoercedTimePtr creates a *time.Time schema with coercion enabled
func Time ¶ added in v0.3.0
Time creates a time.Time schema following Zod TypeScript v4 pattern Usage:
Time() // no parameters
Time("custom error") // string shorthand
Time(SchemaParams{...}) // full parameters
func TimeTyped ¶ added in v0.3.0
func TimeTyped[T TimeConstraint](params ...any) *ZodTime[T]
TimeTyped is the underlying generic function for creating time schemas allowing for explicit type parameterization
func (*ZodTime[T]) Coerce ¶ added in v0.3.0
Coerce implements Coercible interface for time type conversion
func (*ZodTime[T]) DefaultFunc ¶ added in v0.3.0
DefaultFunc keeps the current generic type T.
func (*ZodTime[T]) GetInternals ¶ added in v0.3.0
func (z *ZodTime[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodTime[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodTime[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodTime[T]) Meta ¶ added in v0.3.1
func (z *ZodTime[T]) Meta(meta core.GlobalMeta) *ZodTime[T]
Meta stores metadata for this time schema.
func (*ZodTime[T]) MustParse ¶ added in v0.3.0
func (z *ZodTime[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the type-safe variant that panics on error.
func (*ZodTime[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodTime[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates input with compile-time type safety and panics on failure. This method provides zero-overhead abstraction with strict type constraints.
func (*ZodTime[T]) Nilable ¶ added in v0.3.0
Nilable always returns *time.Time because the value may be nil.
func (*ZodTime[T]) Nullish ¶ added in v0.3.0
Nullish combines optional and nilable modifiers for maximum flexibility
func (*ZodTime[T]) Optional ¶ added in v0.3.0
Optional always returns *time.Time because the optional value may be nil.
func (*ZodTime[T]) Overwrite ¶ added in v0.3.0
Overwrite transforms time value while keeping the same type
func (*ZodTime[T]) Parse ¶ added in v0.3.0
func (z *ZodTime[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns a value that matches the generic type T with full type safety.
func (*ZodTime[T]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodTime[T]) PrefaultFunc ¶ added in v0.3.0
PrefaultFunc keeps the current generic type T.
func (*ZodTime[T]) Refine ¶ added in v0.3.0
Refine applies a custom validation function that matches the schema's output type T. The callback will be executed even when the value is nil (for *time.Time schemas) to align with Zod v4 semantics.
func (*ZodTime[T]) StrictParse ¶ added in v0.4.0
func (z *ZodTime[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodTimeDef ¶ added in v0.3.0
type ZodTimeDef struct {
core.ZodTypeDef
}
ZodTimeDef defines the configuration for time validation
type ZodTimeInternals ¶ added in v0.3.0
type ZodTimeInternals struct {
core.ZodTypeInternals
Def *ZodTimeDef // Schema definition
}
ZodTimeInternals contains time validator internal state
type ZodTransform ¶
ZodTransform represents a schema with a custom transformation.
func (*ZodTransform[In, Out]) GetInner ¶ added in v0.3.1
func (z *ZodTransform[In, Out]) GetInner() core.ZodSchema
GetInner returns the input schema for the transformation.
func (*ZodTransform[In, Out]) GetInternals ¶
func (z *ZodTransform[In, Out]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the ZodTransform schema.
func (*ZodTransform[In, Out]) MustStrictParse ¶ added in v0.4.0
func (z *ZodTransform[In, Out]) MustStrictParse(input Out, ctx ...*core.ParseContext) Out
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodTransform[In, Out]) Parse ¶
func (z *ZodTransform[In, Out]) Parse(input any) (any, error)
Parse applies the transformation to the input value.
func (*ZodTransform[In, Out]) StrictParse ¶ added in v0.4.0
func (z *ZodTransform[In, Out]) StrictParse(input Out, ctx ...*core.ParseContext) (Out, error)
StrictParse validates the input using strict parsing rules and returns the transformed result
func (*ZodTransform[In, Out]) Type ¶ added in v0.3.0
func (z *ZodTransform[In, Out]) Type() core.ZodTypeCode
Type returns the type of the schema
type ZodTransformDef ¶
type ZodTransformDef struct {
core.ZodTypeDef
// contains filtered or unexported fields
}
ZodTransformDef represents the definition of a transformation schema.
func (*ZodTransformDef) Transform ¶ added in v0.3.1
func (d *ZodTransformDef) Transform() func(any, *core.RefinementContext) (any, error)
type ZodTransformInternals ¶
type ZodTransformInternals struct {
core.ZodTypeInternals
Def *ZodTransformDef
}
ZodTransformInternals contains internal state for ZodTransform.
type ZodULID ¶ added in v0.3.0
type ZodULID[T StringConstraint] struct{ *ZodString[T] }
func (*ZodULID[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodULID[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodULID[T]) StrictParse ¶ added in v0.4.0
func (z *ZodULID[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodURL ¶ added in v0.3.0
type ZodURL[T NetworkConstraint] struct { // contains filtered or unexported fields }
ZodURL represents a URL validation schema
func CoercedURL ¶ added in v0.3.0
CoercedURL creates coerced URL schema that attempts string conversion
func URL ¶ added in v0.3.0
URL creates a new URL schema with flexible parameter support Supports various parameter combinations:
URL() - basic URL schema
URL("error message") - with custom error message
URL(URLOptions{Hostname: pattern}) - with URL options
URL(URLOptions{...}, "error message") - options with error message
URL(URLOptions{...}, core.SchemaParams{Description: "URL"}) - options with schema params
URL(core.SchemaParams{Description: "URL"}) - with schema parameters only
func URLPtr ¶ added in v0.3.0
URLPtr creates a new URL schema with pointer type and flexible parameter support Supports the same parameter combinations as URL() but returns *ZodURL[*string]
func URLTyped ¶ added in v0.3.0
func URLTyped[T NetworkConstraint](params ...any) *ZodURL[T]
URLTyped creates a new URL schema with specific type and flexible parameter support
func (*ZodURL[T]) CloneFrom ¶ added in v0.3.0
CloneFrom clones internals from another ZodURL instance
func (*ZodURL[T]) Coerce ¶ added in v0.3.0
Coerce implements type conversion interface using coerce package
func (*ZodURL[T]) DefaultFunc ¶ added in v0.3.0
DefaultFunc preserves current generic type T
func (*ZodURL[T]) GetInternals ¶ added in v0.3.0
func (z *ZodURL[T]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodURL[T]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodURL[T]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodURL[T]) MustParse ¶ added in v0.3.0
func (z *ZodURL[T]) MustParse(input any, ctx ...*core.ParseContext) T
MustParse is the variant that panics on error
func (*ZodURL[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodURL[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse is the strict mode variant that panics on error. Provides compile-time type safety with maximum performance.
func (*ZodURL[T]) Optional ¶ added in v0.3.0
Optional allows nil values, returns pointer type for nullable semantics
func (*ZodURL[T]) Parse ¶ added in v0.3.0
func (z *ZodURL[T]) Parse(input any, ctx ...*core.ParseContext) (T, error)
Parse returns type-safe URL using unified engine API
func (*ZodURL[T]) ParseAny ¶ added in v0.3.0
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodURL[T]) Prefault ¶ added in v0.3.0
Prefault provides fallback values on validation failure
func (*ZodURL[T]) PrefaultFunc ¶ added in v0.3.0
PrefaultFunc provides dynamic fallback values
func (*ZodURL[T]) RefineAny ¶ added in v0.3.0
RefineAny adds a custom refinement function for any type
func (*ZodURL[T]) StrictParse ¶ added in v0.4.0
func (z *ZodURL[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
type ZodURLDef ¶ added in v0.3.0
type ZodURLDef struct {
core.ZodTypeDef
}
ZodURLDef defines the configuration for URL validation
type ZodURLInternals ¶ added in v0.3.0
type ZodURLInternals struct {
core.ZodTypeInternals
Def *ZodURLDef // Schema definition
}
ZodURLInternals contains URL validator internal state
type ZodUUID ¶ added in v0.3.0
type ZodUUID[T StringConstraint] struct{ *ZodString[T] }
func Uuid ¶ added in v0.3.0
Uuid supports optional version parameter: "v4", "v6", "v7". Otherwise behaves like generic UUID validator.
func (*ZodUUID[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodUUID[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodUUID[T]) StrictParse ¶ added in v0.4.0
func (z *ZodUUID[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules
type ZodUnion ¶
ZodUnion represents a union validation schema with dual generic parameters T = base type (any), R = constraint type (any or *any)
func Union ¶
Union creates union schema that accepts one of multiple types - returns value constraint
func UnionOf ¶ added in v0.3.0
UnionOf creates union schema from variadic arguments - returns value constraint
func UnionOfPtr ¶ added in v0.3.0
UnionOfPtr creates union schema from variadic arguments - returns pointer constraint
func UnionPtr ¶ added in v0.3.0
UnionPtr creates union schema that accepts one of multiple types - returns pointer constraint
func UnionTyped ¶ added in v0.3.0
UnionTyped creates typed union schema with generic constraints
func (*ZodUnion[T, R]) DefaultFunc ¶
DefaultFunc preserves current constraint type R
func (*ZodUnion[T, R]) GetInternals ¶
func (z *ZodUnion[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals exposes internal state for framework usage
func (*ZodUnion[T, R]) IsNilable ¶ added in v0.3.0
IsNilable returns true if this schema accepts nil values
func (*ZodUnion[T, R]) IsOptional ¶ added in v0.3.0
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodUnion[T, R]) Meta ¶ added in v0.3.1
func (z *ZodUnion[T, R]) Meta(meta core.GlobalMeta) *ZodUnion[T, R]
Meta stores metadata for this union schema.
func (*ZodUnion[T, R]) MustParse ¶
func (z *ZodUnion[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse validates the input value and panics on failure
func (*ZodUnion[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodUnion[T, R]) MustStrictParse(input T, ctx ...*core.ParseContext) R
MustStrictParse validates input with compile-time type safety and panics on failure
func (*ZodUnion[T, R]) NonOptional ¶ added in v0.3.0
NonOptional removes Optional flag and enforces non-nil value (T).
func (*ZodUnion[T, R]) Optional ¶
Optional creates optional union schema that returns pointer constraint
func (*ZodUnion[T, R]) Parse ¶
func (z *ZodUnion[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse validates input using engine.ParseComplex for unified Default/Prefault handling
func (*ZodUnion[T, R]) ParseAny ¶ added in v0.3.0
ParseAny validates input and returns untyped result for runtime scenarios. Zero-overhead wrapper around Parse to eliminate reflection calls.
func (*ZodUnion[T, R]) Pipe ¶
Pipe creates validation pipeline to another schema using WrapFn pattern
func (*ZodUnion[T, R]) PrefaultFunc ¶
PrefaultFunc keeps current generic type R.
func (*ZodUnion[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodUnion[T, R]) StrictParse(input T, ctx ...*core.ParseContext) (R, error)
StrictParse validates input with compile-time type safety and enhanced performance StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type T.
func (*ZodUnion[T, R]) Transform ¶
func (z *ZodUnion[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform creates type-safe transformation pipeline using WrapFn pattern
type ZodUnionDef ¶
type ZodUnionDef struct {
core.ZodTypeDef
Options []core.ZodSchema // Union member schemas using unified interface
}
ZodUnionDef defines the schema definition for union validation
type ZodUnionInternals ¶
type ZodUnionInternals struct {
core.ZodTypeInternals
Def *ZodUnionDef // Schema definition reference
Options []core.ZodSchema // Union member schemas for runtime validation
}
ZodUnionInternals contains the internal state for union schema
type ZodUnknown ¶
ZodUnknown represents an unknown-value validation schema with dual generic parameters T = base type (any), R = constraint type (any or *any) Unknown accepts any value but provides validation and modifier support
func Unknown ¶
func Unknown(params ...any) *ZodUnknown[any, any]
Unknown creates unknown schema that accepts any value - returns value constraint
func UnknownPtr ¶ added in v0.3.0
func UnknownPtr(params ...any) *ZodUnknown[any, *any]
UnknownPtr creates unknown schema that accepts any value - returns pointer constraint
func UnknownTyped ¶ added in v0.3.0
func UnknownTyped[T any, R any](params ...any) *ZodUnknown[T, R]
UnknownTyped creates typed unknown schema with generic constraints
func (*ZodUnknown[T, R]) CloneFrom ¶
func (z *ZodUnknown[T, R]) CloneFrom(source any)
CloneFrom copies configuration from another schema
func (*ZodUnknown[T, R]) Default ¶
func (z *ZodUnknown[T, R]) Default(v T) *ZodUnknown[T, R]
Default preserves current constraint type R
func (*ZodUnknown[T, R]) DefaultFunc ¶
func (z *ZodUnknown[T, R]) DefaultFunc(fn func() T) *ZodUnknown[T, R]
DefaultFunc preserves current constraint type R
func (*ZodUnknown[T, R]) GetInternals ¶
func (z *ZodUnknown[T, R]) GetInternals() *core.ZodTypeInternals
GetInternals returns the internal state of the schema
func (*ZodUnknown[T, R]) IsNilable ¶ added in v0.3.0
func (z *ZodUnknown[T, R]) IsNilable() bool
IsNilable returns true if this schema accepts nil values
func (*ZodUnknown[T, R]) IsOptional ¶ added in v0.3.0
func (z *ZodUnknown[T, R]) IsOptional() bool
IsOptional returns true if this schema accepts undefined/missing values
func (*ZodUnknown[T, R]) Meta ¶ added in v0.3.1
func (z *ZodUnknown[T, R]) Meta(meta core.GlobalMeta) *ZodUnknown[T, R]
Meta stores metadata for this unknown schema.
func (*ZodUnknown[T, R]) MustParse ¶
func (z *ZodUnknown[T, R]) MustParse(input any, ctx ...*core.ParseContext) R
MustParse is the variant that panics on error
func (*ZodUnknown[T, R]) MustStrictParse ¶ added in v0.4.0
func (z *ZodUnknown[T, R]) MustStrictParse(input R, ctx ...*core.ParseContext) R
MustStrictParse provides compile-time type safety and panics on validation failure. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type R.
func (*ZodUnknown[T, R]) Nilable ¶
func (z *ZodUnknown[T, R]) Nilable() *ZodUnknown[T, *T]
Nilable makes the unknown type nilable and returns pointer constraint
func (*ZodUnknown[T, R]) NonOptional ¶ added in v0.3.0
func (z *ZodUnknown[T, R]) NonOptional() *ZodUnknown[T, T]
NonOptional makes the unknown type non-optional and returns base type constraint
func (*ZodUnknown[T, R]) Nullish ¶
func (z *ZodUnknown[T, R]) Nullish() *ZodUnknown[T, *T]
Nullish combines optional and nilable modifiers
func (*ZodUnknown[T, R]) Optional ¶
func (z *ZodUnknown[T, R]) Optional() *ZodUnknown[T, *T]
Optional makes the unknown type optional and returns pointer constraint
func (*ZodUnknown[T, R]) Overwrite ¶ added in v0.3.0
func (z *ZodUnknown[T, R]) Overwrite(transform func(T) T, params ...any) *ZodUnknown[T, R]
Overwrite applies data transformation while preserving type structure This allows for data cleaning, normalization, and preprocessing operations Unknown type's Overwrite is particularly useful for sanitizing unpredictable data
func (*ZodUnknown[T, R]) Parse ¶
func (z *ZodUnknown[T, R]) Parse(input any, ctx ...*core.ParseContext) (R, error)
Parse returns the input value as-is with full modifier and validation support using unified engine parsing Unknown type has special behavior: it accepts nil by default (unlike other types)
func (*ZodUnknown[T, R]) ParseAny ¶ added in v0.3.0
func (z *ZodUnknown[T, R]) ParseAny(input any, ctx ...*core.ParseContext) (any, error)
ParseAny validates the input value and returns any type (for runtime interface)
func (*ZodUnknown[T, R]) Pipe ¶
Pipe creates validation pipeline to another schema using WrapFn pattern
func (*ZodUnknown[T, R]) Prefault ¶
func (z *ZodUnknown[T, R]) Prefault(v T) *ZodUnknown[T, R]
Prefault provides fallback values on validation failure
func (*ZodUnknown[T, R]) PrefaultFunc ¶
func (z *ZodUnknown[T, R]) PrefaultFunc(fn func() T) *ZodUnknown[T, R]
PrefaultFunc provides dynamic fallback values
func (*ZodUnknown[T, R]) Refine ¶
func (z *ZodUnknown[T, R]) Refine(fn func(R) bool, args ...any) *ZodUnknown[T, R]
Refine applies type-safe validation with constraint type R
func (*ZodUnknown[T, R]) RefineAny ¶
func (z *ZodUnknown[T, R]) RefineAny(fn func(any) bool, args ...any) *ZodUnknown[T, R]
RefineAny provides flexible validation without type conversion
func (*ZodUnknown[T, R]) StrictParse ¶ added in v0.4.0
func (z *ZodUnknown[T, R]) StrictParse(input R, ctx ...*core.ParseContext) (R, error)
StrictParse provides compile-time type safety by requiring exact type matching. This eliminates runtime type checking overhead for maximum performance. The input must exactly match the schema's constraint type R.
func (*ZodUnknown[T, R]) Transform ¶
func (z *ZodUnknown[T, R]) Transform(fn func(T, *core.RefinementContext) (any, error)) *core.ZodTransform[R, any]
Transform creates type-safe transformation pipeline using WrapFn pattern
type ZodUnknownDef ¶
type ZodUnknownDef struct {
core.ZodTypeDef
}
ZodUnknownDef defines the configuration for unknown value validation
type ZodUnknownInternals ¶
type ZodUnknownInternals struct {
core.ZodTypeInternals
Def *ZodUnknownDef // Schema definition
}
ZodUnknownInternals contains unknown validator internal state
type ZodXID ¶ added in v0.3.0
type ZodXID[T StringConstraint] struct{ *ZodString[T] }
func (*ZodXID[T]) MustStrictParse ¶ added in v0.4.0
func (z *ZodXID[T]) MustStrictParse(input T, ctx ...*core.ParseContext) T
MustStrictParse validates the input using strict parsing rules and panics on error
func (*ZodXID[T]) StrictParse ¶ added in v0.4.0
func (z *ZodXID[T]) StrictParse(input T, ctx ...*core.ParseContext) (T, error)
StrictParse validates the input using strict parsing rules