The big argument going round is that they don’t handle tuples effectively, Nostr tags are tuples, effectively, and I’ve experienced quite a lot of false-positives-and-negatives using Zod, requiring pretty unintuitive code-jitsu to remedy.

Reply to this note

Please Login to reply.

Discussion

Are the issues with tuples in the generated typescript types or the validation of events. Looking at their docs they do have a tuple type and it seems to support rest types [string, string, ...string]

I'm curious because I like zod. although the more I look into this I'm thinking a JSON schema approach might be simpler then limiting it to TS

Great question, and definitely worth exploring / validating. Keep me in the loop, I’m all-brain-elsewhere at the moment but in a few months I’ll be asking these juicy questions.

I think cross-language availability is a big selling point for JSON schemas, as well.

Need to do more testing, but I tend to agree. JSON schemas would allow any language to use it, although I'm worried that some of the stuff like pattern matching or strict Typescript types might not get compiled. and thats mainly what I'm after.

I want to call a isContacts method in typescript and know for certain that all "p" tags have a hex value