turkerdev / fastify-type-provider-zod

MIT License
303 stars 19 forks source link

Support for `z.readonly()` #67

Open thorhj opened 8 months ago

thorhj commented 8 months ago

There is currently no support for returning readonly arrays/object. This can be modelled with zod using e.g. z.array(...).readonly() since zod version 3.22.0. When using .readonly the resulting schema would be empty due to missing support from zod-to-json-schema.

I raised this issue with zod-to-json-schema here: https://github.com/StefanTerdell/zod-to-json-schema/issues/90

Now that the issue has been fixed with zod-to-json-schema version 3.22.0, support can be added to fastify-type-provider-zod simply by upgrading to version 3.22.0 as well.

kibertoad commented 8 months ago

@thorhj can you send a PR with test?

thorhj commented 8 months ago

@kibertoad Yes, but I don't have a lot of time currently so it may take some time 🥲