smithy.api.HttpHeader.scala Maven / Gradle / Ivy
package smithy.api
import smithy4s.Hints
import smithy4s.Newtype
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.schema.Schema.bijection
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.string
/** Binds a structure member to an HTTP header. */
object HttpHeader extends Newtype[String] {
val id: ShapeId = ShapeId("smithy.api", "httpHeader")
val hints: Hints = Hints(
smithy.api.Documentation("Binds a structure member to an HTTP header."),
smithy.api.Trait(selector = Some("structure > :test(member > :test(boolean, number, string, timestamp,\nlist > member > :test(boolean, number, string, timestamp)))"), structurallyExclusive = None, conflicts = Some(List(smithy.api.NonEmptyString("smithy.api#httpLabel"), smithy.api.NonEmptyString("smithy.api#httpQuery"), smithy.api.NonEmptyString("smithy.api#httpPrefixHeaders"), smithy.api.NonEmptyString("smithy.api#httpPayload"), smithy.api.NonEmptyString("smithy.api#httpResponseCode"), smithy.api.NonEmptyString("smithy.api#httpQueryParams"))), breakingChanges = Some(List(smithy.api.TraitDiffRule(change = smithy.api.TraitChangeType.ANY.widen, severity = smithy.api.Severity.ERROR.widen, path = None, message = None)))),
).lazily
val underlyingSchema: Schema[String] = string.withId(id).addHints(hints).validated(smithy.api.Length(min = Some(1L), max = None))
implicit val schema: Schema[HttpHeader] = recursive(bijection(underlyingSchema, asBijection))
}