fastify-type-provider-zod icon indicating copy to clipboard operation
fastify-type-provider-zod copied to clipboard

Support for `z.readonly()`

Open thorhj opened this issue 2 years ago • 2 comments

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.

thorhj avatar Nov 21 '23 08:11 thorhj

@thorhj can you send a PR with test?

kibertoad avatar Nov 21 '23 08:11 kibertoad

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

thorhj avatar Nov 22 '23 10:11 thorhj