smithy.api.Deprecated.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
/** Marks a shape or member as deprecated.
* @param message
* The reason for deprecation.
* @param since
* A description of when the shape was deprecated (e.g., a date or
* version).
*/
final case class Deprecated(message: Option[String] = None, since: Option[String] = None)
object Deprecated extends ShapeTag.Companion[Deprecated] {
val id: ShapeId = ShapeId("smithy.api", "deprecated")
val hints: Hints = Hints(
smithy.api.Documentation("Marks a shape or member as deprecated."),
smithy.api.Trait(selector = None, structurallyExclusive = None, conflicts = None, breakingChanges = None),
).lazily
// constructor using the original order from the spec
private def make(message: Option[String], since: Option[String]): Deprecated = Deprecated(message, since)
implicit val schema: Schema[Deprecated] = recursive(struct(
string.optional[Deprecated]("message", _.message).addHints(smithy.api.Documentation("The reason for deprecation.")),
string.optional[Deprecated]("since", _.since).addHints(smithy.api.Documentation("A description of when the shape was deprecated (e.g., a date or\nversion).")),
)(make).withId(id).addHints(hints))
}