Zod Record and Map for unknown object key/value construction

40 views Asked by At

I'm using Zod for schema validation and I have been provided with a schema for the request body I should be expecting, however one of the fields simply just describes object or null with no hint at what might be contained within the object... In the example responses this key is always null, which again doesn't help.

I have looked at Zod's record but I'm not sure that I fully understand it. From what I can gather, it seems like I can only specify one value type for the entirety of the object, whereas I'm unsure what I will be getting...

Can anyone help provide me with an example of how I can define a truly dynamic object?

0

There are 0 answers