smithy4s.smithy.rules.ContextParam.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kinesis4cats-smithy4s-client_native0.4_3 Show documentation
Show all versions of kinesis4cats-smithy4s-client_native0.4_3 Show documentation
Cats tooling for the Smithy4s Kinesis Client
package smithy.rules
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
/** Binds the targeted member of an operation's input structure to the named rule-set parameter.
* The type of the shape targeted by the trait MUST match the parameter type defined in the rule-set.
* @param name
* The rule-set parameter name.
*/
final case class ContextParam(name: String)
object ContextParam extends ShapeTag.Companion[ContextParam] {
val id: ShapeId = ShapeId("smithy.rules", "contextParam")
val hints: Hints = Hints(
smithy.api.Documentation("Binds the targeted member of an operation\'s input structure to the named rule-set parameter.\nThe type of the shape targeted by the trait MUST match the parameter type defined in the rule-set."),
smithy.api.Unstable(),
smithy.api.Trait(selector = Some("operation -[input]-> structure > member"), structurallyExclusive = None, conflicts = None, breakingChanges = None),
).lazily
// constructor using the original order from the spec
private def make(name: String): ContextParam = ContextParam(name)
implicit val schema: Schema[ContextParam] = recursive(struct(
string.required[ContextParam]("name", _.name).addHints(smithy.api.Documentation("The rule-set parameter name.")),
)(make).withId(id).addHints(hints))
}