smithy.api.ExampleError.scala Maven / Gradle / Ivy
package smithy.api
import smithy4s.Document
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.document
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct
final case class ExampleError(shapeId: Option[ShapeId] = None, content: Option[Document] = None)
object ExampleError extends ShapeTag.Companion[ExampleError] {
val id: ShapeId = ShapeId("smithy.api", "ExampleError")
val hints: Hints = Hints(
smithy.api.Private(),
).lazily
// constructor using the original order from the spec
private def make(shapeId: Option[ShapeId], content: Option[Document]): ExampleError = ExampleError(shapeId, content)
implicit val schema: Schema[ExampleError] = struct(
string.refined[ShapeId](smithy.api.IdRef(selector = "structure[trait|error]", failWhenMissing = None, errorMessage = None)).optional[ExampleError]("shapeId", _.shapeId),
document.optional[ExampleError]("content", _.content),
)(make).withId(id).addHints(hints)
}