[zod-mock] Controlling how optional properties get mocked
nathpaiement opened this issue · comments
Hey,
So based on some tests I made with this plugin and a quick look at the code, it seems like optional properties always get mocked. Unless there's a strong case for leaving things as is, I would suggest adding the ability to define how such properties are handled in the options. Maybe something like:
generateMock(schema, {
mockOptionals: 'always' (default) | 'never' | 'random',
});
Setting that option to never would in my case be very useful as I'm doing some API patching during development with this plugin and would prefer not to patch more than what's "required" in our schemas but missing from the actual API.
Thanks for considering this feat. request!
Would also love to see this implemented