question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

question: shared validators

See original GitHub issue

Is it possible to do shared validators? For example build a DTO with class-validator for array, string, number validators that can be used in other places.

function(@Query('id') id:QueryNumberDto)

import { IsNumber, Max, IsNotEmpty } from 'class-validator';
import { Transform } from 'class-transformer'
export class id:QueryNumberDto {
    @IsNumber()
    @IsNotEmpty()
    @Transform(value => Number(value))
    (dynamic): Number;
}

something like that, that in error i can return a dynamic field

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
johannesschobelcommented, Mar 26, 2020

You can also create a new Decorator for your Validator, that calls the other decorators. In JS/TS decorators are just functions that are called.

0reactions
github-actions[bot]commented, Dec 17, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Response Requirements & Validation
Custom validation is used when you need your respondent to answer a question in a specific way. For example, you may want them...
Read more >
angular - How to share custom validators between modules
How to share custom validators between modules · Just remove PasswordValidator from both i.e. SignupModule and AuthModule instead add it in root ...
Read more >
decorator information missing from shared project · Issue ...
I moved CreateLoginInput class to shared-lib project to make other projects consume input validation. When CreateLoginInput is included from ...
Read more >
Proof-of-Work Proponents Question Validator Censorship ...
Proof-of-Work Proponents Question Validator Censorship as 59% of Staked Ethereum Is Held by 4 Companies. Prior to The Merge, Ethereum used to ...
Read more >
Validate a Question in Qualtrics - YouTube
How to create validation on a question using Qualtrics survey software tool at Purdue University.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found