Attributes
- Companion
- class
- Graph
-
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ValidationError.type
Members list
Type members
Inherited and Abstract types
The names of the product elements
The names of the product elements
Attributes
- Inherited from:
- Mirror
The name of the type
The name of the type
Attributes
- Inherited from:
- Mirror
Value members
Concrete methods
Creates an error for a single violated rule.
Creates an error for a single violated rule.
The message is Invalid <field>: <reason>, violations is List(reason), and context holds field and violations.
Value parameters
- field
-
the name of the field that failed validation
- reason
-
why the value was rejected
Attributes
- Returns
-
the validation error
Creates an error for several violated rules.
Creates an error for several violated rules.
The message is Invalid <field>: followed by the violations joined with ", ", while context("violations") joins them with "; ". An empty list gives a message that ends after the colon and a context with no violations entry.
Value parameters
- field
-
the name of the field that failed validation
- violations
-
the rules that were violated, in the order given
Attributes
- Returns
-
the validation error
Creates an error for a field whose value is not acceptable.
Creates an error for a field whose value is not acceptable.
The message is Field '<field>' is invalid: <reason> (it does not use the Invalid <field>: form) and violations is List(reason).
Value parameters
- field
-
the name of the field that failed validation
- reason
-
why the value was rejected
Attributes
- Returns
-
the validation error
Creates an error for a missing required field.
Creates an error for a missing required field.
The message is Field '<field>' is required (it does not use the Invalid <field>: form) and violations is List("required").
Value parameters
- field
-
the name of the missing field
Attributes
- Returns
-
the validation error
- Example
-
val error = ValidationError.required("name") error.message // "Field 'name' is required" error.violations // List("required")
Unapply extractor for pattern matching
Unapply extractor for pattern matching