News for hackers. Stuff that matters.
Re:Parsix: Parse Don't Validate by Waterluvian on Saturday May 15, 2021 @03:26PM (#27168113)
I developed a pattern in typescript (I'm sure it's not original) where I have an interface describing an API entity and a class of the same name with only static methods, one of which is Foo.fromApi() that validates and parses.

I haven't seen any need to bring a library in to handle this. Though it would be nice to marry the worlds of TS, API, and Json Schema.

Re:Parsix: Parse Don't Validate by lhnz on Saturday May 15, 2021 @03:36PM (#27168206)
It doesn't use json schema but you might be interested in something like this: https://gcanti.github.io/io-ts/

(You can define runtime encoder/decoders which produce typed values.)

Re:Parsix: Parse Don't Validate by brundolf on Saturday May 15, 2021 @05:13PM (#27169081)
io-ts is fantastic (I linked it myself above). The killer feature is that it infers the static types of your runtime schemas for you, so you don't have to define them twice. You make a change to the schema, the rest of your code will typecheck against it.