anatine / zod-plugins

Plugins and utilities for Zod

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[zod-mock] How to generate input schema data?

ColinCee opened this issue · comments

Currently zod mock always generates the output schema data

example

  const Schema = z.object({
    yesNo: z.enum(['Yes', 'No']).transform((value) => value === 'Yes'),
  });

  const data = generateMock(Schema)

/* 
Data is
{
  yesNo: true,
}
*/

However I want it in the raw input type so I can create mock data for my unit tests to validate data is correct.

{
  yesNo: "Yes"
}