Socket
Socket
Sign inDemoInstall

@regionaalenergieloket/nest-class-validator-decorator

Package Overview
Dependencies
12
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @regionaalenergieloket/nest-class-validator-decorator

Forked from https://github.com/Bholtland/nest-class-validator-decorator/


Version published
Weekly downloads
14
increased by7.69%
Maintainers
7
Created
Weekly downloads
 

Readme

Source

nest-class-validator-decorator

A custom decorator that uses the class-transformer and class-validator npm packages under the hood to deserialize method response data and validate it according to a supplied "class-validator" class.

Getting started

Add the decorator as a dependency to your project npm install -S nest-class-validator-decorator or yarn add -S nest class-validator-decorator.

You can now import the decorator into your code like so:

import {ValidateResponse} from "nest-class-validator-decorator"

...

@ValidateResponse(YourSchema)
public yourMethod() {
    // Your logic...
}

Any JSON returned from "yourMethod" will now be validated according to "YourSchema".

Options

As a secondary param you can add an "options" object containing ValidatorOptions from "class-validator".

FAQs

Last updated on 29 Jan 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc