raflymln / zod-key-parser

Parse your Zod schema into keys or Prisma ORM select format
https://www.npmjs.com/package/zod-key-parser
MIT License
16 stars 0 forks source link

Refine bug #35

Closed Lon4ry closed 5 months ago

Lon4ry commented 6 months ago

If you try to do refine on all data of schema and try to check if it's an object you will get unexpectly false.

Example:

import * as zod from "zod";
import { isZodObject, parseZodSchema } from "zod-key-parser";

const schema = zod.object({
  password: zod.string(),
  confirm: zod.string(),
})
.refine(({ password, confirm }) => password === confirm, {
  message: "",
  path: ["confirm"],
});

console.log(isZodObject(schema)); // false
console.log(parseZodSchema(schema)); // as a result, keys will be just {}
raflymln commented 5 months ago

Hi, this issue has been fixed in the latest release! @Lon4ry sorry for waiting