dutils-validation 1.1.0

Validation annotations for dlang structs


To use this package, run the following command in your project's root directory:

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", "name@example.com", "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.0 2020-May-11
~master 2020-May-11
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 1 downloads this week

  • 2 downloads this month

  • 73 downloads total

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