
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@betsys-nestjs/decorators
Advanced tools
This library is a collection of various decorators using class-validator.
@betsys-nestjs/decoratorsThis is a simple library containing decorators helping you to validate types of properites
| Package | Version |
|---|---|
| @nestjs/common | ^10.0.0 |
| class-validator | ^0.13.2 |
The basic usage is similar to the class-validator. Use decorators in your DTOs or commands.
An example of usage - imagine a DTO as following:
export class SomeNiceDto {
booleanProperty!: boolean;
intProperty!: number;
};
Which you want to use in the following controller while it is automatically converted from the request:
import { Body, Controller, Post, Req } from '@nestjs/common';
import { Request } from 'express';
@Controller()
export class SomeController {
@Post('/some-url')
saveKittens(@Req() request: Request, @Body() body: SomeNiceDto) {
...
}
}
For the DTO you want to be sure, that booleanProperty is of type boolan
as well as that intProperty is really an integer.
You can easily enforce that by using the decorators from this lib:
import { IsFieldBoolean, IsFieldInteger, Language } from '@betsys-nestjs/decorators';
export class SomeNiceDto {
@IsFieldBoolean('booleanProperty', Language.PL)
booleanProperty!: boolean;
@IsFieldInteger('intProperty', Language.EN)
intProperty!: number;
};
The language settings concern the error message. If you do not provide any language, English is returned.
FAQs
This library is a collection of various decorators using class-validator.
The npm package @betsys-nestjs/decorators receives a total of 1 weekly downloads. As such, @betsys-nestjs/decorators popularity was classified as not popular.
We found that @betsys-nestjs/decorators demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.