question: omit values
See original GitHub issueHi, Im build a nestjs API and I’m using class-validator.
I’m having little issues, but to be honest, I dont have much experience with class-validator.
I have 2 api operations POST and PATCH. When admin creates a new bot, all attributes should be validated by api. When admin updates something, the data should be updated partially.
Below, you can see my class:
@Exclude()
export class BotDto {
@IsString()
@Length(2, 50)
@Expose()
readonly name: string;
@IsString()
@IsEmail()
@Expose()
readonly email: string;
@IsString()
@Matches(/^\d{17}$/)
// @IsBotSteamIdAlreadyExist()
@Expose()
readonly steamid: string;
@IsString()
@Length(8, 32)
@Expose()
readonly steampass: string;
@IsString()
@IsBase64()
@Expose()
readonly sharedSecret: string;
@IsString()
@IsBase64()
@Expose()
readonly identitySecret: string;
}
I’m trying to use @IsOptional({groups: ['patch']}) but isn’t working.
How can I omit some validations?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:18 (7 by maintainers)
Top Results From Across the Web
Remove unnecessary values from an Object in R Programming
omit () Function. na. omit() function in R Language is used to omit all unnecessary cases from data frame, matrix or vector.
Read more >3 Example Codes for na.omit (Data Frame, Vector & by Column)
The na.omit R function removes all incomplete cases of a data object (typically of a data frame, matrix or vector). The syntax above...
Read more >Omit values when fitting (lmfit nan_policy) - Stack Overflow
Now say for some arbitrary reason my signal is cutoff. Some part of my gaussian shaped signal is missing (some saturation effect). Fitting...
Read more >How to test if a value is `omit`? - ansible - Server Fault
In the YAML file omit is just a plain string. To pass the special variable it has to be enclosed in the templating...
Read more >Solved: Excluding a value in a list - Esri Community
I have two survey questions that reference the same list_name values . I wanted to know if it was possible to exclude the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This is still a problem.
I think the best way is to set
always: trueby default or create a global validator configuration where you can change the default behavior for this flag