GithubHelp home page GithubHelp logo

nestjs / class-validator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from typestack/class-validator

62.0 62.0 10.0 4.88 MB

Fork of the class-validator package. Decorator-based property validation for classes.

License: MIT License

TypeScript 99.81% JavaScript 0.19%

class-validator's People

Contributors

0xflotus avatar adnan-kamili avatar braaar avatar christophercr avatar cyri-l avatar dependabot[bot] avatar dystopianprogrammer avatar edcarroll avatar felipesabino avatar greenkeeper[bot] avatar henrikra avatar honoluluhenk avatar jerradpatch avatar jucrouzet avatar kamilmysliwiec avatar kiancross avatar kiliandeca avatar mheironimus avatar michallytek avatar neilime avatar nonameprovided avatar pleerock avatar renovate-bot avatar rmuchall avatar rubiin avatar salimlou avatar snyk-bot avatar vincent-chapron avatar vlapo avatar ytetsuro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

class-validator's Issues

0.13.4 misses @types/validator

Did you read the migration guide?

  • I have read the whole migration guide (there is none)

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Potential Commit/PR that introduced the regression

PR #72

Versions

0.13.3 -> 0.13.4

Describe the regression

Hi,

We upgraded to @nestjs/[email protected] and receive the following error during nest build:

Could not find a declaration file for module 'validator'.
Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

I saw that #72 removes the dependency.
Has this been an accidental merge issue or are we expected to install @types/validator ourselves?

Cheers,
Steffen

Minimum reproduction code

No response

Expected behavior

@nestjs/class-validator should work out-of-the-box.

Other

No response

Validation Array

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Hi, I am try use validation in NestJS follow document, I need send this query "/api/tournaments/TournamentsList?filterBy=id&filter=1&searchBy=title&search=akiira" is normally query and this my function in controller

`@Get('TournamentsList')
@ApiCreatedResponse({ type: MessageResultAPIModel })
@UsePipes(new ValidationPipe())
async TournamentsList(
@query() dataQuery: QueryObject
) {
try {
console.log(dataQuery.filterBy)
return this.tournamentService.TournamentListService(dataQuery)

} catch (err) {

}

}`

and this my class QueryObject

`export class QueryObject {
@IsString({ each: true })
@isarray()
@IsOptional()
filterBy?: string[]

@IsString({ each: true })
@isarray()
@IsOptional()
filter?: string[]

@IsString({ each: true })
@isarray()
@IsOptional()
searchBy?: string[]

@IsString()
@IsOptional()
search?: string

@IsString()
@IsOptional()
sortBy?: string

@IsEnum(ESorter)
@IsOptional()
sort: Sorter

@IsNumber()
@IsOptional()
page: number

@IsNumber()
@IsOptional()
perPage: number

@IsString({ each: true })
@isarray()
@IsOptional()
selectField?: string[]

@isboolean()
@IsOptional()
TransformDateTime: boolean
}`

When I send request to server have error
{ "statusCode": 400, "message": [ "filterBy must be an array", "filter must be an array", "searchBy must be an array" ], "error": "Bad Request" }

And If I remove @IsArray() result log is "id" should ["id"].

How I can validation is code. Thanks support.

Minimum reproduction code

https://github.com/Jeniphan

Steps to reproduce

No response

Expected behavior

And If I remove @IsArray() result log is "id" should ["id"].

Package version

^0.14.0

NestJS version

No response

Node.js version

^9.0.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

fix: medium vulnerability reported by snyk

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Snyk security scan reports that nestjs/class-validator has medium vulnerability related to dependency out-of-date.
The medium vulnerability related to dependency out-of-date can be fixed easily by upgrading the validation dependency to 13.7.0 version.

Minimum reproduction code

https://snyk.io/vuln/npm%3Avalidator

Steps to reproduce

No response

Expected behavior

Library should not have security vulnerabilities.

Package version

0.13.3

NestJS version

No response

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): replace dependency rollup-plugin-terser with @rollup/plugin-terser ^0.1.0
  • fix(deps): update dependency libphonenumber-js to v1.10.60
  • chore(deps): update dependency @rollup/plugin-node-resolve to v15.2.3
  • chore(deps): update dependency @types/node to v18.19.31
  • chore(deps): update dependency eslint to v8.57.0
  • chore(deps): update dependency eslint-config-prettier to v8.10.0
  • chore(deps): update dependency lint-staged to v13.3.0
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency eslint-config-prettier to v9
  • chore(deps): update dependency eslint-plugin-jest to v28
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency rollup to v4
  • chore(deps): update dessant/lock-threads action to v5
  • chore(deps): update github/codeql-action action to v3
  • chore(deps): update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v2
  • github/codeql-action v1
  • github/codeql-action v1
  • github/codeql-action v1
.github/workflows/continuous-deployment-workflow.yml
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/continuous-integration-workflow.yml
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/lock-closed-issues-workflow.yml
  • dessant/lock-threads v3
npm
package.json
  • @types/validator ^13.7.10
  • libphonenumber-js ^1.10.14
  • validator ^13.7.0
  • @rollup/plugin-commonjs ^23.0.4
  • @rollup/plugin-node-resolve ^15.0.1
  • @types/jest ^29.2.4
  • @types/node ^18.11.12
  • @typescript-eslint/eslint-plugin ^5.46.0
  • @typescript-eslint/parser ^5.46.0
  • eslint ^8.29.0
  • eslint-config-prettier ^8.5.0
  • eslint-plugin-jest ^27.1.6
  • husky ^4.3.8
  • jest ^29.3.1
  • lint-staged ^13.1.0
  • prettier ^2.8.1
  • reflect-metadata 0.1.13
  • rimraf 3.0.2
  • rollup ^2.79.1
  • rollup-plugin-terser ^7.0.2
  • ts-jest ^29.0.3
  • ts-node ^10.9.1
  • typescript ^4.9.4

  • Check this box to trigger a request for Renovate to run again on this repository

ESM error with dependency `libphonenumber-js`

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

../node_modules/.pnpm/@[email protected]/node_modules/@nestjs/class-validator/types/decorator/string/IsPhoneNumber.d.ts:2:29 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("libphonenumber-js")' call instead.

2 import { CountryCode } from 'libphonenumber-js';
                               ~~~~~~~~~~~~~~~~~~~

../node_modules/.pnpm/[email protected]/node_modules/libphonenumber-js/index.d.ts:18:8 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.

18 } from './types';
          ~~~~~~~~~

Minimum reproduction code

no

Steps to reproduce

No response

Expected behavior

no error message

Package version

0.13.4

NestJS version

9.3.9

Node.js version

20.1.8

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

upstream also suffers from that: typestack#1947 (comment)

Add shim file for browsers

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

Creating a shim file with a reduced size for the browser would be a nice to have.

Describe the solution you'd like

Create a shim file for each decorator, using the same approach as @nestjs/swagger package.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

I would like to reuse dtos files between frontend and backend projects. Opening issue before creating a PR to check if it would be a good idea.

Critical severity vulnerability

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Running npm run audit throws a critical severity vulnerability on this package.

GHSA-fj58-h2fr-3pp2

Minimum reproduction code

GHSA-fj58-h2fr-3pp2

Steps to reproduce

  1. Install @nestjs/mapped-types
  2. Run npm audit

Expected behavior

There should be no critical vulnerabilities

Package version

0.13.1

NestJS version

8.0.0

Node.js version

18.12.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: includeForks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.