sddevelopment-be / modular-validators

A lightweight validation framework for the JVM, allowing for internal and external validation logic to be combined in a transparant and reusable way
https://sddevelopment-be.github.io/modular-validators/
European Union Public License 1.2
2 stars 0 forks source link

ADR: Write a custom validation DSL #9

Open stijn-dejongh opened 3 hours ago

stijn-dejongh commented 3 hours ago

Generate validator code from PlantUML custom theme specification

Context

Most organizations have business-minded individuals or non-software engineers defining the specifications of the software (internal clients, product owners, analysts, managers, end-users).

Problem

Business validation rules are tedious to maintain, as the translation from business specification into executable validation code involves multiple hand-overs and knowledge-extraction events. In the end, there is seldom time to maintain this consistently.

Current "Behaviour Driven Development" approaches lack the direct feedback to the end users, and are rather verbose (cfr. Cucumber, Gherkin, Finesse, JBehave, ...)

Intent

Solution

Reasoning

Considered alternatives

References

Example: Potential DSL API


ValidatorFor(".*IDENTIFIABLE_PART_OF_FILE_NAME.*\\.csv") {
   RecordIdentifier('ROW_ID')
   FieldMatches('FIELD_NAME', 'MAY_NOT_BE_EMPTY')
   FieldExists('JOSKE_WAS_HERE')

   ValidationCase("description") {
     RecordExists('12345')
     RecordHasValue('12345', 'FIELD_NAME', 'expectedValue')
   }
}
stijn-dejongh commented 2 hours ago

Implementation plan

Reasoning