smithy.api.Recommended.scala Maven / Gradle / Ivy
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))
}