timdeschryver / zod-fixture

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

fix: defaults conflict with user checks #73

Closed THEtheChad closed 1 year ago

THEtheChad commented 1 year ago

This PR adds a new utility resolveValue that takes an initial value, a fallback value, and a potential conflicting value (from checks, etc). The return value matches the typeof the initial value and is determined using the following logic:

  1. If the value is defined, return the value
  2. If the value is undefined and there's a conflicting value that IS defined, use a resolver to calculate the return value
  3. If the value is undefined and the conflicting value is undefined, use the "fallback" value (ie default value).
vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
zod-fixture ✅ Ready (Inspect) Visit Preview Jul 19, 2023 0:39am
github-actions[bot] commented 1 year ago

:tada: This PR is included in version 2.1.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: