dutils-validation 1.1.1

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

DUB Package Posix Build Status

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", "[email protected]", "no", "some body");

validate(email); // throws an instance of ValidationErrors

TODO

  • [ ] Support for nested structs and arrays
Authors:
  • Fredrik Söderström
Dependencies:
none
Versions:
1.1.1 2022-Aug-15
1.1.0 2020-May-11
~master 2022-Aug-15
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 104 downloads total

Score:
0.8
Short URL:
dutils-validation.dub.pm