Releases: timdeschryver/zod-fixture
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.0
2.0.0 (2023-07-17)
Features
BREAKING CHANGES
This version is a total rewrite of v1.
For more info, check out the documentation at https://zod-fixture.timdeschryver.dev/ .
Thanks for all the help @THEtheChad 🤝
Why a rewrite?
v1 was flexible and allowed that multiple validation libraries could be supported in the future.
But, this made things more complex and I don't think we intended to add more libraries than zod.
v2 is a full-on zod version.
This benefits you because we make more use of zod's schema while creating fixtures.
For example, when you want to create a custom generator (previously a customization) you can also access zod's schema definition.
Fixture Generation with 1:1 Zod Parity
Breaking changes
createFixture
createFixture still exists, but it could be that it generated its output with a slightly different output.
It still is compatible (even more compatible) with zod's schema.
For example, the changes to a string output:
BEFORE:
street-a088e991-896e-458c-bbbd-7045cd880879
AFTER:
fbmiabahyvsy-vm
Customization
Customization is renamed to Generator.
BEFORE:
const addressCustomization: Customization = {
condition: ({ type, propertName }) =>
type === 'object' && propertName === 'address',
generator: () => {
return {
street: 'My Street',
city: 'My City',
state: 'My State',
};
},
};AFTER:
const addressGenerator = Generator({
schema: ZodObject,
filter: ({ context }) => context.path.at(-1) === 'address',
output: () => ({
street: 'My Street',
city: 'My City',
state: 'My State',
}),
});For more info, check out the documentation at https://zod-fixture.timdeschryver.dev/ .