All Downloads are FREE. Search and download functionalities are using the official Maven repository.

smithy.api.Error.scala Maven / Gradle / Ivy

There is a newer version: 0.19.0-41-91762fb
Show newest version
package smithy.api

import smithy4s.Enumeration
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.EnumTag
import smithy4s.schema.Schema.enumeration

/** Indicates that a structure shape represents an error.
  * 
  * All shapes referenced by the errors list of an operation MUST be targeted
  * with this trait.
  */
sealed abstract class Error(_value: String, _name: String, _intValue: Int, _hints: Hints) extends Enumeration.Value {
  override type EnumType = Error
  override val value: String = _value
  override val name: String = _name
  override val intValue: Int = _intValue
  override val hints: Hints = _hints
  override def enumeration: Enumeration[EnumType] = Error
  @inline final def widen: Error = this
}
object Error extends Enumeration[Error] with ShapeTag.Companion[Error] {
  val id: ShapeId = ShapeId("smithy.api", "error")

  val hints: Hints = Hints(
    smithy.api.Documentation("Indicates that a structure shape represents an error.\n\nAll shapes referenced by the errors list of an operation MUST be targeted\nwith this trait."),
    smithy.api.Trait(selector = Some("structure"), structurallyExclusive = None, conflicts = Some(List(smithy.api.NonEmptyString("smithy.api#trait"))), breakingChanges = Some(List(smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.ANY.widen, severity = smithy.api.Severity.ERROR.widen, path = None, message = None)))),
  ).lazily

  case object CLIENT extends Error("client", "CLIENT", 0, Hints.empty)
  case object SERVER extends Error("server", "SERVER", 1, Hints.empty)

  val values: List[Error] = List(
    CLIENT,
    SERVER,
  )
  val tag: EnumTag[Error] = EnumTag.ClosedStringEnum
  implicit val schema: Schema[Error] = enumeration(tag, values).withId(id).addHints(hints)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy