zod-auto-schema
v1.0.0
Published
Automatically generate Zod schemas from runtime objects
Maintainers
Readme
this package is used to extract and turn normal object format into zod object format
usage:
import { ExtractTypes } from "@sage/zod-auto-schema"
const obj = { name: "uzumaki naruto", password: "GonNaBeccoCmeAHokage", id: 111568 }
const init = new ExtractTypes(obj); const extracted = init.extract() // methods that turns object format into zod object console.log(extracted);
result:
{ name : z.string(), password: z.string(), id : z.number() }
the method supports string number boolean array bigint object null undefined feilds for now ...
