astahmer / openapi-zod-client

Generate a zodios (typescript http client with zod validation) from an OpenAPI spec (json/yaml)
openapi-zod-client.vercel.app
717 stars 80 forks source link

fix: convert additionalPropsDefaultValue to bool #248

Closed nmcdaines closed 8 months ago

nmcdaines commented 8 months ago

A feature (#230) was added to the cli to give a user flexibility of allowing additional properties on types defined by the generator by omitting the .passthrough() deceleration on a zod schema - which should resolve #196

When trying this feature, I discovered it wasn't possible to set the flag additionalPropsDefaultValue correctly as the cli returns a string and the openApiToZod method expects a boolean for this value

I've refactored the match statement used for withAlias to be a helper method called toBoolean and consumed from the same location as withAlias does.

vercel[bot] commented 8 months ago

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

Name Status Preview Comments Updated (UTC)
openapi-zod-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 10:29pm
astahmer commented 8 months ago

hey, LGTM ! could you add a changeset ?

nmcdaines commented 8 months ago

Hey @astahmer, thanks for reviewing and apologies for not including a changeset 🙏 I've amended my previous commit to include a changeset 👍