Skip to content

Support readonly entities#71

Open
kibertoad wants to merge 3 commits intomainfrom
feat/ro-support
Open

Support readonly entities#71
kibertoad wants to merge 3 commits intomainfrom
feat/ro-support

Conversation

@kibertoad
Copy link
Copy Markdown
Collaborator

fixes #67

@kibertoad
Copy link
Copy Markdown
Collaborator Author

@thorhj Can you check the repro here? It isn't failing for me even on the old zod-to-json-schema. What am I missing?

@kibertoad
Copy link
Copy Markdown
Collaborator Author

So tests were passing, but TS build was not. So I ended up just synchronizing the versions; guess it's not worse than it was before anyway.

@kibertoad
Copy link
Copy Markdown
Collaborator Author

@thorhj If I publish a prerelease version with this, will you be able to confirm it works as expected?

@thorhj
Copy link
Copy Markdown

thorhj commented Nov 28, 2023

@kibertoad Yes I will be able to do that 👍

@thorhj
Copy link
Copy Markdown

thorhj commented Dec 8, 2023

@kibertoad Just let me know when you publish a pre-release version with this change 😄

@kibertoad
Copy link
Copy Markdown
Collaborator Author

@thorhj My apologies, I think I got distracted by something else and never got to it. Could you please check 1.2.0? I think it should help

@fredrikj31
Copy link
Copy Markdown

Hey @kibertoad

I just want to jump into the conversation, because I'm experiencing the same problem.

I'm working with the Slonik database library, which returns a readonly array, when fetching multiple rows from the database.

I have added the zod schema, which is a standard object array, with the necessary properties inside of it, so it matches the rows returned from the database. But when I'm trying to return my array of items, I get an error complaining about the array being a readonly array, which makes sense, because that's what Slonik is returning.

The only solution that I found that I can use to return the readonly array, is to spread the array, so it turns into a "normal" array. Is this an error with this library or Slonik?

Was this supposed to be shipped in version 1.2.0?

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 this pull request may close these issues.

Support for z.readonly()

3 participants