UNPKG

nestjs-typebox

Version:

This library provides helper utilities for writing and validating NestJS APIs using [TypeBox](https://github.com/sinclairzx81/typebox) as an alternative to class-validator/class-transformer. It also includes a patch for @nestjs/swagger allowing OpenAPI ge

13 lines (11 loc) 407 B
import { BadRequestException, HttpStatus } from '@nestjs/common'; import { ValueError } from '@sinclair/typebox/errors'; export class TypeboxValidationException extends BadRequestException { constructor(errors: IterableIterator<ValueError>) { super({ statusCode: HttpStatus.BAD_REQUEST, message: 'Validation failed', errors: [...errors], }); } }