FINERACT-1470: Fineract release plugin
This commit is contained in:
committed by
Aleksandar Vidakovic
parent
b185937962
commit
40eb547a5c
@@ -0,0 +1,32 @@
|
||||
= Validation
|
||||
|
||||
== Programmatic
|
||||
|
||||
Use the https://github.com/apache/fineract/search?q=%22class+DataValidatorBuilder%22[DataValidatorBuilder], e.g. like so:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
new DataValidatorBuilder().resource("fileUpload")
|
||||
.reset().parameter("Content-Length").value(contentLength).notBlank().integerGreaterThanNumber(0)
|
||||
.reset().parameter("FormDataContentDisposition").value(fileDetails).notNull()
|
||||
.throwValidationErrors();
|
||||
----
|
||||
|
||||
Such code is often encapsulated in https://github.com/apache/fineract/search?q=Validator[`*Validator`] classes (if more than a few lines, and/or reused from several places; avoid copy/paste), like so:
|
||||
|
||||
[source,java]
|
||||
----
|
||||
public class YourThingValidator {
|
||||
|
||||
public void validate(YourThing thing) {
|
||||
new DataValidatorBuilder().resource("yourThing")
|
||||
...
|
||||
.throwValidationErrors();
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
== Declarative
|
||||
|
||||
[FINERACT-1229](https://issues.apache.org/jira/browse/FINERACT-1229) is an open issue about adopting Bean Validation for _declarative_ instead of _programmatic_ (as above) validation. Contributions welcome!
|
||||
Reference in New Issue
Block a user