metadata(...) { } attaches entries
to every violation of the rules inside its block:
Withdrawal.kt
Where it goes
metadata works in two places, with the same meaning:
- In the validation block, around properties: every violation of those properties gets the entries.
- In the block of a property, around constraints: only the violations of those constraints get them.
metadata("operationId" to id) around ::operations required { each { valid() } } reaches the violations of every operation.
Reading it
Violation.metadata is a Map<String, Any?>, empty when nothing was attached:
The fields of the presence rules
The presence rules, such asexactlyOneOf, attach a fields entry of
their own, with the properties to fill or to clear: