/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.0.1 * User agent: apibuilder app.apibuilder.io/bml/validation/0.0.1/http4s_0_18 */ package org.bml.validation.v0.models { /** * A response object for field 409 conflict errors resulting from trying to create * a resource that already exists. * * @param status The response status. * @param message The response message. */ final case class ConflictResourceExistsResponse( status: Int, message: String ) /** * Error description object for a single field. * * @param path The object path of the field. * @param message A user friendly error message. */ final case class FieldValidationError( path: String, message: String ) /** * A single validation error description. * * @param message A user friendly error message. * @param errors A field validation type. */ final case class FieldValidationErrorEntry( message: String, errors: org.bml.validation.v0.models.FieldValidationErrorType ) /** * A response object for field validation errors. * * @param status The response status. * @param message The response message. * @param errors A set of field validation errors. */ final case class FieldValidationResponse( status: Int, message: String, errors: Seq[org.bml.validation.v0.models.FieldValidationError] ) /** * Error types for field validation. */ sealed trait FieldValidationErrorType extends _root_.scala.Product with _root_.scala.Serializable object FieldValidationErrorType { /** * Field is null or missing. */ case object IsNull extends FieldValidationErrorType { override def toString = "isNull" } /** * Field is empty. */ case object IsEmpty extends FieldValidationErrorType { override def toString = "isEmpty" } /** * Field length is less than the minimum allowed. */ case object MinimumLength extends FieldValidationErrorType { override def toString = "minimumLength" } /** * Field exceeds the maximum allowable length. */ case object MaximumLength extends FieldValidationErrorType { override def toString = "maximumLength" } /** * Field does not match a predefined pattern. */ case object Pattern extends FieldValidationErrorType { override def toString = "pattern" } /** * Field syntax type error. */ case object Syntax extends FieldValidationErrorType { override def toString = "syntax" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends FieldValidationErrorType /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[FieldValidationErrorType] = scala.List(IsNull, IsEmpty, MinimumLength, MaximumLength, Pattern, Syntax) private val byName: Map[String, FieldValidationErrorType] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): FieldValidationErrorType = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[FieldValidationErrorType] = byName.get(value.toLowerCase) } }