timdeschryver / zod-fixture

Creating fixtures based on zod schemas
https://zod-fixture.timdeschryver.dev/
MIT License
121 stars 10 forks source link

fix: add peer dependency to zod #19

Closed timdeschryver closed 1 year ago

timdeschryver commented 1 year ago
timdeschryver commented 1 year ago

@THEtheChad I had to change the implementation of multipleOf because it was flaky, and it was also returning values that weren't compatible with zod.

That's why I also created the following test, maybe we should do this for most of them to be sure we're following zod's rules. Or, atleast great some integration tests to verify that fixtures are OK.

        test("creates a number that's a multiple", () => {
            const schema = z.number().multipleOf(4);
            const result = core.generate(schema);
            expect(() => schema.parse(result)).not.toThrow();
        });
THEtheChad commented 1 year ago

I think this is a great idea, @timdeschryver. There's one issue I can foresee. I created a separate PR (https://github.com/timdeschryver/zod-fixture/pull/25) to address this with the example you provided. I have a detailed explanation in the description.

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 2.0.0-beta.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: