Better HN
topnewbestaskshowjobs
Log inSign up

rsinger86

1 karma · joined Feb 7, 2018 (8y ago) · 4 submissions

Submissions

comment 3y ago · link · parent

I wasn't satisfied with zod* or class-validator* in NestJS projects, so I built this.

It's meant to be a complete solution for data transfer objects:

- A single construct for serialization and deserialization. zod and class-validator only handle parsing.

- Syntax and style closer to JSON Schema and OpenAPI for aligned mental models. zod uses chained methods, class-validator uses decorators.

- Straightforward way to integrate the HTTP context when parsing. Validation often depends on the requesting user.

- Static types by default. To get static types with zod, you must make an extra infer call. To get static types with class-validator, you must make a redundant type declaration.

*Both zod and class-validator are powerful and seem good for lots of use cases, just not my cup of tea for HTTP JSON APIs.

2.

Show HN: Simpler DTO modeling for TypeScript/NestJS projects(github.com ↗)

8 points · by rsinger86 · 3y ago · 1 comment

3.

Show HN: New parsing/validation library for Node/TypeScript (DTO classes)(github.com ↗)

4 points · by rsinger86 · 3y ago · discuss

comment 8y ago · link · parent

Also +1 Django REST Framework, it's been a huge productivity boost for us. For a small team dealing with a large codebase, its high-level abstractions provide lot of consistency while also providing enough flexibility for more specific use cases.