Skip to content

Validation (Unsupported)

Jan Bernitt edited this page Apr 13, 2026 · 4 revisions

Lists JSON schema validations that were considered but are currently unsupported. They might be added in a later release but there are no plans for that ATM. This page is mainly supposed to preserve the understanding of how the JSON schema concept would fit into the Java annotation based validation.

items

The items state for each element of an array what is expected (in terms of JSON schema constraints). This allows very precise control over how an array should look like down to each single element in it. When mapping JSON to a Java model it is unlikely such control is needed. A typed language like java would model this as an object with specific properties rather than an array with specific elements.

Anyhow, if it were to be included in @Validation, we would add

Class<?>[] items() default {};

Each Class<?> reference would correspond to an array and would expected to be annotated with @Validation. This is the only way to use annotations "recursively" (for the items) by referencing an annotated type.

Clone this wiki locally