astahmer / openapi-zod-client

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

Add option to provide coercion #281

Open asross opened 3 months ago

asross commented 3 months ago

I'm generating a zod object from an openapi schema, and I'd like it to be able to coerce values, e.g. converting strings to numbers. It would be easy if I was able to edit the zod object directly, but the schema gets updated periodically, and I want to be able to automatically pull in changes without having to reproduce my edits.

How easy would it be to implement this feature?

amvFrontendMonkey commented 2 months ago

@astahmer I'd be willing to provide a PR for opt-in coercion

Is this something you'd accept?