Remix.run Logo
8n4vidtmkvmk 3 days ago

Zod might be a validation library, but it also does type coercion and transforms. I believe that's what the author means by a parser.

goku12 3 days ago | parent [-]

Apparently not. The author cites the example of json parsing for APIs. You usually don't split it into a generic parsing into native data types and then validate the result in memory (unless you're on a dynamically typed language and don't use a validation schema). Instead, the expected native data type of the result (composed using structs, enums, unions, vectors, etc) is defined first and then you try to parse the json into that data type. Any json errors and schema violations will error out in a single step.