All Downloads are FREE. Search and download functionalities are using the official Maven repository.

smithy.api.ExampleError.scala Maven / Gradle / Ivy

There is a newer version: 0.19.0-41-91762fb
Show newest version
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)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy