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

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

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

import smithy4s.Hints
import smithy4s.Newtype
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.schema.Schema.bijection
import smithy4s.schema.Schema.list
import smithy4s.schema.Schema.recursive

/** Constrains the acceptable values of a string to a fixed set
  * of constant values.
  * @param member
  *   An enum definition for the enum trait.
  */
@deprecated(message = "The enum trait is replaced by the enum shape in Smithy 2.0", since = "2.0")
object Enum extends Newtype[List[EnumDefinition]] {
  val id: ShapeId = ShapeId("smithy.api", "enum")
  val hints: Hints = Hints(
    smithy.api.Documentation("Constrains the acceptable values of a string to a fixed set\nof constant values."),
    smithy.api.Trait(selector = Some("string :not(enum)"), structurallyExclusive = None, conflicts = None, breakingChanges = Some(List(smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.PRESENCE.widen, severity = smithy.api.Severity.ERROR.widen, path = None, message = None)))),
    smithy.api.Deprecated(message = Some("The enum trait is replaced by the enum shape in Smithy 2.0"), since = Some("2.0")),
  ).lazily
  val underlyingSchema: Schema[List[EnumDefinition]] = list(EnumDefinition.schema).withId(id).addHints(hints).validated(smithy.api.Length(min = Some(1L), max = None))
  implicit val schema: Schema[Enum] = recursive(bijection(underlyingSchema, asBijection))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy