←back to thread

Parse, Don't Validate (2019)

(lexi-lambda.github.io)
389 points melse | 1 comments | | HN request time: 0.306s | source
Show context
Attummm ◴[] No.27640130[source]
That's how the validation tool for Python Maat works. By creating a completely new dictionary. https://github.com/Attumm/Maat
replies(2): >>27640197 #>>27640762 #
errnesto ◴[] No.27640197[source]
For js / typescript I like: https://github.com/paperhive/fefe

basically ist’s just functions that take a value of one type and return a other one

replies(1): >>27640857 #
vorticalbox ◴[] No.27640857[source]
There is also joi, zod, myzod just to name a few.

I personally use myzod as its fast it parsing, zero dependancies and you can infre types from your schemas.

replies(1): >>27642240 #
1. catlifeonmars ◴[] No.27642240[source]
Don’t forget https://github.com/gcanti/io-ts