Closed Couto closed 7 months ago
@Couto thank you for bringing this up.
To be completely honest - we've never into the option of providing keys to the record. I would have to check how the schema looks like within zod and come back to you with an answer of whether or not it is possible
Hey @Couto - I've just opened a PR with pretty much your example in the tests - feel free to take a look. Hopefully we should be able to review, merge and publish it soon.
Thank you so much for this, and the quick response.
I'm not sure if this is working as intended, but I will explain my problem and my expectations:
We're building a quizz where users have to associate countries with continents, the answers might contain wrong associations ofc.
As far as Zod is concerned, this works fine. The problem is the generated Open API file, which could be a bit better (imho). As is, right now, the generated file contains the following:
However, my expectation of the final Open API file was something like:
Is my expectation wrong here? I know it's possible to use the
z.object
to achieve the final example, and it works fine with a small number of keys, but codewise thez.enum
should work? Is this something that can be improved?