Created
April 7, 2021 18:07
-
-
Save 1gravity/d9bbc8f563b894de4d8868f46b506a23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val spec = validationSpec(messageBundle = "MyMessages", locale = Locale.FRENCH) { | |
constraints<MyClass> { | |
property(MyClass::color) { | |
notBlank() | |
inValues("GREEN", "WHITE", "RED") | |
size(3, 5) | |
} | |
property(MyClass::token) { | |
regexp("[A-Za-z0-9]+") | |
} | |
property(MyClass::date) { | |
future() | |
} | |
returnOf(Foo::validate) { | |
assertTrue() | |
} | |
property(MyClass::innerClass) { | |
valid() | |
} | |
} | |
constraints<InnerClass> { | |
property(InnerClass::amount) { | |
negativeOrZero() | |
} | |
property(InnerClass::emailList) { | |
notEmpty() | |
eachElement { | |
notNull() | |
email() | |
} | |
} | |
} | |
} | |
@1gravity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment