smithy4s.smithy.rules.ClientContextParamDefinition.scala Maven / Gradle / Ivy
package smithy.rules
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct
/** A client context parameter definition.
* @param type
* The Smithy shape type that should be used to generate a client configurable for the rule-set parameter.
* @param documentation
* Documentation string to be generated with the client parameter.
*/
final case class ClientContextParamDefinition(_type: ShapeType, documentation: Option[String] = None)
object ClientContextParamDefinition extends ShapeTag.Companion[ClientContextParamDefinition] {
val id: ShapeId = ShapeId("smithy.rules", "ClientContextParamDefinition")
val hints: Hints = Hints(
smithy.api.Documentation("A client context parameter definition."),
smithy.api.Unstable(),
smithy.api.Private(),
).lazily
// constructor using the original order from the spec
private def make(_type: ShapeType, documentation: Option[String]): ClientContextParamDefinition = ClientContextParamDefinition(_type, documentation)
implicit val schema: Schema[ClientContextParamDefinition] = struct(
ShapeType.schema.required[ClientContextParamDefinition]("type", _._type).addHints(smithy.api.Documentation("The Smithy shape type that should be used to generate a client configurable for the rule-set parameter.")),
string.optional[ClientContextParamDefinition]("documentation", _.documentation).addHints(smithy.api.Documentation("Documentation string to be generated with the client parameter.")),
)(make).withId(id).addHints(hints)
}