zod
zod copied to clipboard
Feature Request: async preprocess
I’m trying to parse some minecraft NBT data with zod. However, in order to do this, one key of the object (item_bytes) first needs to be converted from the binary NBT format to a JSON-like structure.
The best way to implement this in my opinion would be to use zod’s z.preprocess(). Unfortunately, the library I’m using prismarine-nbt only exposes parse as an async function.
As far as I can tell, async preprocessing is not supported right now. I think it would be great if it’s allowed as it would really simplify parsing with async libraries.
I’d suggest either z.preprocess(async () => { /* ... */ }, z.any()) or z.preprocessAsync(async () => { /* ... */ }, z.any()) as I think either would be reasonable from an API standpoint.
Yep, seems like an oversight, should be a quick addition. I'll look into it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@stale this issue is still relevant
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@stale don’t
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@stale don't
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@stale don't
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@stale don’t
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.