▲ | ffsm8 3 days ago | |||||||
I dont disagree with the desire to get a good API like that. I was just pointing out that this was the core of the desire the author had, as 12_throw_away was correctly pointing out that _true_ parsing and making invalid state unrepresentable forces you to error out on the first missmatch, which makes it impossible to raise multiple issues. the only way around that is to allow invalid state during the input phase. zod also allows invalid state as input, then attempts to shoehorn them into the desired schema, which still runs these validations the author was complaining about - just not in the code he wrote. | ||||||||
▲ | Lvl999Noob 3 days ago | parent | next [-] | |||||||
Why does "true" parsing have to error out on the very first problem? It is more than possible (though maybe not easy) to keep parsing and collecting errors as they appear. Zod, as the given example in the post, does it. | ||||||||
| ||||||||
▲ | MrJohz 3 days ago | parent | prev [-] | |||||||
I don't know that I understand why parsing necessarily has to error out on the first mismatch. Good parsers will collect errors as they go along. Zod does take in invalid state as input, but that is what a parser does. In this case, the parser is `any -> T` as opposed to `string -> T`, but that's still a parsing operation. | ||||||||
|