turkerdev / fastify-type-provider-zod

MIT License
303 stars 19 forks source link

Support readonly entities #71

Open kibertoad opened 7 months ago

kibertoad commented 7 months ago

fixes #67

kibertoad commented 7 months ago

@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 commented 7 months ago

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 commented 7 months ago

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

thorhj commented 7 months ago

@kibertoad Yes I will be able to do that 👍

thorhj commented 7 months ago

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

kibertoad commented 2 months ago

@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 commented 2 months ago

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?