Our great sponsors
-
ditsmod
Ditsmod is a Node.js web framework, named DI + TS + Mod to emphasize its important components: it has Dependency Injection, written in TypeScript, and designed for good Modularity.
-
ajv
The fastest JSON schema Validator. Supports JSON Schema draft-04/06/07/2019-09/2020-12 and JSON Type Definition (RFC8927)
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
Nest
A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
This post compares NestJS v9.2.0 and Ditsmod v2.27.0. A finished example of validation with the Ditsmod application can be viewed at github. I am the author of Ditsmod.
In the @ditsmod/openapi-validation module, at the moment, the utility ajv directly performs the validation itself.
Note that headers and cookies cannot be handled similarly in NestJS. While there are workarounds for this, it's still pretty weird and doesn't add consistency to NestJS.
The description of the request body model in NestJS is similar to the description of Ditsmod models, but NestJS uses decorators provided by the utility class-validator. In NestJS, it is customary to name the request body model with the ending *Dto (this is an abbreviation of Data transfer object):