dutils-validation ~master
Validation annotations for dlang structs
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
validation
Validation annotations for dlang structs
example
import dutils.validation.constraints : ValidateRequired, ValidateEmail
struct Email {
@ValidateRequired()
@ValidateEmail()
string to;
@ValidateRequired()
@ValidateEmail()
string from;
@ValidateMinimumLength(3)
@ValidateMaximumLength(100)
string subject;
string body;
}
auto email = Email("badto.address", "name@example.com", "no", "some body");
validate(email); // throws an instance of ValidationErrors
TODO
- [ ] Support for nested structs and arrays
- ~master released 2 years ago
- d-utils/validation
- github.com/d-utils/validation
- MIT
- Copyright © 2020, Fredrik Söderström
- Authors:
- Dependencies:
- none
- Versions:
-
1.1.1 2022-Aug-15 1.1.0 2020-May-11 ~master 2022-Aug-15 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
0 downloads total
-
- Score:
- 0.8
- Short URL:
- dutils-validation.dub.pm