Skip to main content
The constraints of a Map as a whole. Their size messages count entries, not items, so they have messages of their own (minEntries, maxEntries, entries, entriesBetween). To check every key or value, use eachKey and eachValue.
A null argument checks nothing. A rule that reads a value that may be missing, such as max(customer.limit), never fails because of it: required on that value reports it once.
Translations.kt

How many

minSize

minSize(min) on Map Checks that the map has at least min entries. minSize

maxSize

maxSize(max) on Map Checks that the map has at most max entries. maxSize

size

size(size) on Map Checks that the map has exactly size entries. size

sizeBetween

sizeBetween(min, max) on Map Checks that the map has between min and max entries, both included. sizeBetween

notEmpty

notEmpty() on Map Checks that the map has at least one entry. notEmpty

empty

empty() on Map Checks that the map has no entries. empty

Keys and values

containsKey

containsKey(key) on Map Checks that the map has the key key. containsKey

containsKeys

containsKeys(keys) on Map Checks that the map has every one of keys. containsKeys

notContainsKey

notContainsKey(key) on Map Checks that the map does not have the key key. notContainsKey

onlyKeys

onlyKeys(keys) on Map Checks that every key of the map is one of keys. Not every key of keys has to be there. Combine it with containsKeys for that. onlyKeys

containsValue

containsValue(value) on Map Checks that the map has value as the value of some entry. containsValue