DTO Validator
DTO VALIDATOR is custom rxjs operator responsible for:
- object creation based on class-transformer library
- DTO validation
Pipe uses class-transformer npm package to create class instanced based on provided class type. Created instance is then verified with class-validator package. On success pipe returns created class instance. On invalid DTO it throws error (instance of DtoError class) with list of errors.
USE EXAMPLE
- Install npm package
npm install gg-dto-validator
- Create Class DTO with class-validator decorators
;
- Use ggpDTO rxjs operator in service
;;;;
- Creating DTO for ggpDTO rxjs operator with nested array of objects
;;