validateEach
sttp.tapir.Schema$.annotations$.validateEach
class validateEach[T](val v: Validator[T]) extends StaticAnnotation, Serializable
Adds the v
validators to elements of the schema, when the annotated class or field is a collection or Option. The type of the validator must match exactly the type of the collection's elements. This is not checked at compile-time, and might cause run-time exceptions. E.g. to validate that when an Option[Int]
is defined, the value is smaller than 5, you should use:
case class Payload(
@validateEach(Validator.max(4, exclusive = true))
aField: Option[Int]
)
Attributes
- Graph
-
- Supertypes
-
trait Serializabletrait StaticAnnotationclass Annotationclass Objecttrait Matchableclass Any
Members list
In this article