Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for z.readonly() #67

Open
thorhj opened this issue Nov 21, 2023 · 2 comments · May be fixed by #71
Open

Support for z.readonly() #67

thorhj opened this issue Nov 21, 2023 · 2 comments · May be fixed by #71

Comments

@thorhj
Copy link

thorhj commented Nov 21, 2023

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: StefanTerdell/zod-to-json-schema#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
Copy link
Collaborator

@thorhj can you send a PR with test?

@thorhj
Copy link
Author

thorhj commented Nov 22, 2023

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

@kibertoad kibertoad linked a pull request Nov 27, 2023 that will close this issue
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 a pull request may close this issue.

2 participants