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

smithy.api.Recommended.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.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct

/** Indicates that a structure member SHOULD be set.
  * @param reason
  *   Provides a reason why the member is recommended.
  */
final case class Recommended(reason: Option[String] = None)

object Recommended extends ShapeTag.Companion[Recommended] {
  val id: ShapeId = ShapeId("smithy.api", "recommended")

  val hints: Hints = Hints(
    smithy.api.Documentation("Indicates that a structure member SHOULD be set."),
    smithy.api.Trait(selector = Some("structure > member"), structurallyExclusive = None, conflicts = Some(List(smithy.api.NonEmptyString("smithy.api#required"))), breakingChanges = None),
  ).lazily

  // constructor using the original order from the spec
  private def make(reason: Option[String]): Recommended = Recommended(reason)

  implicit val schema: Schema[Recommended] = recursive(struct(
    string.optional[Recommended]("reason", _.reason).addHints(smithy.api.Documentation("Provides a reason why the member is recommended.")),
  )(make).withId(id).addHints(hints))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy