package validation
- Alphabetic
- By Inheritance
- validation
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
ErrorCode
extends AnyRef
A base trait for error codes, all error codes need to extend this.
A base trait for error codes, all error codes need to extend this. It's available for you so you can add more in your app
-
class
ErrorCodeSerializer
extends Serializer[ErrorCode]
Assumes your error codes will always be case objects.
-
case class
FieldName
(name: String) extends Product with Serializable
Encapsulates a field name for use in a validation error
Encapsulates a field name for use in a validation error
- name
The name of the field
-
case class
ValidationError
(message: String, field: Option[FieldName], code: Option[ErrorCode], args: Seq[Any]) extends Product with Serializable
Encapsulates errors in an API
Encapsulates errors in an API
- message
The message for this error
- field
An optional field name, useful when it applies to a particular field
- code
Decouple business logic error types from http errors
- args
Optional args, these need to be serializable to json if you're using the org.scalatra.validation.ValidationErrorSerializer
-
class
ValidationErrorSerializer
extends CustomSerializer[ValidationError]
Serializes a validation error into a structure:
{ "message": "the error message", "field": "field_name", "code": "ValidationFail", "args": [] }
Serializes a validation error into a structure:
{ "message": "the error message", "field": "field_name", "code": "ValidationFail", "args": [] }
You can configure whether or not to include the args. And on the way in it assumes args are JValues. The fields: field, code and args are only added if they have actual data.
Value Members
- object BadGateway extends ErrorCode with Product with Serializable
- object GatewayTimeout extends ErrorCode with Product with Serializable
- object NotFound extends ErrorCode with Product with Serializable
- object NotImplemented extends ErrorCode with Product with Serializable
- object ServiceUnavailable extends ErrorCode with Product with Serializable
- object UnknownError extends ErrorCode with Product with Serializable
- object Validation
-
object
ValidationError
extends Serializable
Allows for unordered building of org.scalatra.validation.ValidationError
- object ValidationFail extends ErrorCode with Product with Serializable
- object Validators