smithy4s.smithy.rules.StaticContextParams.scala Maven / Gradle / Ivy
package smithy.rules
import smithy4s.Hints
import smithy4s.Newtype
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.schema.Schema.bijection
import smithy4s.schema.Schema.map
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.string
/** Binds one or more named rule-set parameters to the defined static value for the targeted operation.
* The type of the targeted shape targeted by the trait MUST match the parameter type defined in the rule-set.
* @param key
* The rule-set parameter name.
* @param value
* The static parameter definition.
*/
object StaticContextParams extends Newtype[Map[String, StaticContextParamDefinition]] {
val id: ShapeId = ShapeId("smithy.rules", "staticContextParams")
val hints: Hints = Hints(
smithy.api.Documentation("Binds one or more named rule-set parameters to the defined static value for the targeted operation.\nThe type of the targeted shape targeted by the trait MUST match the parameter type defined in the rule-set."),
smithy.api.Unstable(),
smithy.api.Trait(selector = Some("operation"), structurallyExclusive = None, conflicts = None, breakingChanges = None),
).lazily
val underlyingSchema: Schema[Map[String, StaticContextParamDefinition]] = map(string.addMemberHints(smithy.api.Documentation("The rule-set parameter name.")), StaticContextParamDefinition.schema.addMemberHints(smithy.api.Documentation("The static parameter definition."))).withId(id).addHints(hints)
implicit val schema: Schema[StaticContextParams] = recursive(bijection(underlyingSchema, asBijection))
}