Package

org.scalatra

validation

Permalink

package validation

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. validation
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait ErrorCode extends AnyRef

    Permalink

    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

  2. class ErrorCodeSerializer extends Serializer[ErrorCode]

    Permalink

    Assumes your error codes will always be case objects.

  3. case class FieldName(name: String) extends Product with Serializable

    Permalink

    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

  4. case class ValidationError(message: String, field: Option[FieldName], code: Option[ErrorCode], args: Seq[Any]) extends Product with Serializable

    Permalink

    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

  5. class ValidationErrorSerializer extends CustomSerializer[ValidationError]

    Permalink

    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

  1. object BadGateway extends ErrorCode with Product with Serializable

    Permalink
  2. object GatewayTimeout extends ErrorCode with Product with Serializable

    Permalink
  3. object NotFound extends ErrorCode with Product with Serializable

    Permalink
  4. object NotImplemented extends ErrorCode with Product with Serializable

    Permalink
  5. object ServiceUnavailable extends ErrorCode with Product with Serializable

    Permalink
  6. object UnknownError extends ErrorCode with Product with Serializable

    Permalink
  7. object Validation

    Permalink
  8. object ValidationError extends Serializable

    Permalink

    Allows for unordered building of org.scalatra.validation.ValidationError

  9. object ValidationFail extends ErrorCode with Product with Serializable

    Permalink
  10. object Validators

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped