Skip to content

Conversation

@sudowoodo200
Copy link

@sudowoodo200 sudowoodo200 commented Apr 14, 2024

Three fixes

  1. When there is a default value, the TS type will be optional. When .default() is used, Zod infers the input field to be optional, even if the field is required. This makes sense because we are parsing inputs. The strictly correct way is to build two types, Type and TypeInput. But it is bloated. This serves its purpose.
  2. Scattered nullable additions that we forgot before
  3. ZodSchema chaining for "oneOf" types. I suspect there are more bugs like this, but for future fixes.

This should now work on both the full petstore.yaml example and the gigantic openai specs

One JSDoc test is failing. I'm not sure what's going on.

@vercel
Copy link

vercel bot commented Apr 14, 2024

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

Name Status Preview Comments Updated (UTC)
openapi-zod-client-rim4 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 14, 2024 1:25pm

@sudowoodo200 sudowoodo200 marked this pull request as ready for review April 14, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant