Is it possible to validate one field without groups?
See original GitHub issueFor example I have class:
class ExampleModel extends Model {
@MinLength(10)
@IsAlphanumeric()
public password: string;
@IsEmail()
@IsDefined()
public email: string;
}
Can I validate only email or password, without validating other fields?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:19 (4 by maintainers)
Top Results From Across the Web
Restrict data input by using validation rules - Microsoft Support
Create a field validation rule · Select the field that you want to validate. · On the Fields tab, in the Field Validation...
Read more >Use Validation Groups for Buttons with Multiple Validation Rules
Present two buttons to the end user that, based on the selection, will validate only after a particular button is clicked. screenshot of...
Read more >Validate the fields of a form - OutSystems 11 Documentation
Set the data types of the values in the form. You can do this manually or scaffold the form fields from Entity. Set...
Read more >Bean Validation: Practical Examples from a Real- World Java ...
annotations placed on a field, method, or class of a JavaBeans component, ... We'll add another class “Course” to illustrate validating by group....
Read more >Spring MVC Custom Validation - Baeldung
The isValid() method retrieves the values of the two fields and checks if they are equal. 9.3. Applying the Annotation.
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

@NoNameProvided I have a similar problem. From my UI, I need to call validate on blur and in this case I’d only want to validate the field I just blurred from. And blur from next field I’d want to validate that field only and so on. If only we could pass in property name or better yet the path to property (to handle nested objects) in ValidatorOptions, it would be possible to avoid unnecessary extra validations. As @Horat1us suggested, currently a way around to achieve this is to use groups but having 1 group per field just so that we can target it only is a lot of code bloat.
A workaround way is that you only pass one field and validate with
skipMissingPropertiesoption.