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

smithy.api.Deprecated.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

/** 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))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy