smithy4s

package smithy4s

Members list

Type members

Classlikes

trait Bijection[A, B] extends A => B

A bijection is an association of two opposite functions A => B and B => A.

A bijection is an association of two opposite functions A => B and B => A.

A bijection MUST abide by the round-tripping property, namely, for all input A :

bijection.from(bijection(input)) == input

Attributes

Companion
object
Supertypes
trait A => B
class Object
trait Matchable
class Any
Self type
Bijection[A, B]
object Bijection

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Bijection.type
sealed trait Blob

A Blob represents an arbitrary piece of binary data that fits in memory.

A Blob represents an arbitrary piece of binary data that fits in memory.

Its underlying data structure enables several types of layouts, as well as efficient concatenation.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Blob

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Blob.type
final case class ConstraintError(hint: Hint, message: String) extends Throwable, NoStackTrace

Attributes

Supertypes
trait Product
trait Equals
trait NoStackTrace
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
sealed trait Document extends Product, Serializable

A json-like free-form structure serving as a model for the Document datatype in smithy.

A json-like free-form structure serving as a model for the Document datatype in smithy.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class DArray
class DBoolean
object DNull
class DNumber
class DObject
class DString
Show all
object Document

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Document.type
trait Endpoint[Op[_, _, _, _, _], I, E, O, SI, SO]

A representation of a smithy operation.

A representation of a smithy operation.

Type parameters

E:

the error ADT of the operation (Nothing if N/A)

I:

the input type of the operation (Unit if N/A)

O:

the output of the operation (Unit if N/A)

Op:

the GADT of all operations in a service

SI:

the Streamed input of the operaton (Nothing if N/A)

SO:

the Streamed output of the operaton (Nothing if N/A) This type carries references to the Schemas of the various types involved, allowing to compile corresponding codecs. Optionally, an endpoint can have an ErrorSchema which allows for matching throwables against the errors the operation knows about (which form an ADT in the Scala representation) NB: SI an SO respectively are derived from the @streaming trait in smithy. If this trait is present in one on one of the members of Input/Output, the member is removed from the Scala representation, in order to avoid polluting datatypes that typically fit in memory with concerns of streaming (which can be encoded a great many ways, using a great many libraries)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
Endpoint[Op, I, E, O, SI, SO]
object Endpoint

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Endpoint.type
trait EndpointHandler[Op[_, _, _, _, _], F[_, _, _, _, _]]

Composable handler that allows to implement a specific endpoint in isolation.

Composable handler that allows to implement a specific endpoint in isolation.

Handlers are composable and can be reconciled into the service the operations belong to.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Handler[F]

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait Enumeration[E <: Value] extends Companion[E]

Attributes

Companion
object
Supertypes
trait Companion[E]
trait Has[E]
trait ShapeTag[E]
trait HasId
class Object
trait Matchable
class Any
Show all
Known subtypes
object Enumeration

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait HasId

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Newtype[A]
object HttpMediaType
object Auth
object Default
object Documentation
object Enum
object EnumValue
object Examples
object HttpError
object HttpHeader
object HttpQuery
object JsonName
object MediaType
object Pattern
object References
object Since
object Suppress
object Tags
object Title
object TraitShapeId
object XmlName
object Acceptors
object Waitable
object WaiterDelay
object WaiterName
object ProtoIndex
object DataExamples
object DefaultValue
object Discriminated
object UrlFormName
trait Service[Alg]
trait Mixin[Alg, Op]
trait Reflective[Op]
class ShapeId
trait ShapeTag[A]
trait Companion[A]
object HttpBinding
object InputOutput
trait Companion[E]
trait Enumeration[E]
object Error
object Severity
object AcceptorState
object ProtoNumType
object AddedDefault
object Box
object Cors
object Deprecated
object Endpoint
object EventHeader
object EventPayload
object Example
object ExampleError
object HostLabel
object Http
object HttpBasicAuth
object HttpLabel
object HttpPayload
object IdRef
object Idempotent
object Input
object Internal
object Length
object Mixin
object NoReplace
object NotProperty
object OptionalAuth
object Output
object Paginated
object Private
object Property
object Range
object Readonly
object Recommended
object Reference
object Required
object Retryable
object Sensitive
object Sparse
object Streaming
object Trait
object TraitDiffRule
object UniqueItems
object Unit
object UnitType
object Unstable
object XmlAttribute
object XmlFlattened
object XmlNamespace
object Acceptor
object Matcher
object PathMatcher
object Waiter
object EmailFormat
object Grpc
object ProtoEnabled
object ProtoWrapped
object Range
object DataExample
object DateFormat
object Nullable
object OpenEnum
object Untagged
object UuidFormat
Show all
sealed abstract class HintMask

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object HintMask

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
HintMask.type
trait Hints

A hint is an arbitrary piece of data that can be added to a schema, at the struct level, or at the field/member level.

A hint is an arbitrary piece of data that can be added to a schema, at the struct level, or at the field/member level.

You can think of it as an annotation that can communicate additional information to encoders/decoders (for instance, a change in a label, a regex pattern some string should abide by, a range, etc)

This Hints interface is a container for hints.

Under the hood, the hints are composed of two maps : one for member-level hints, one for target-level hints. Member-level hints typically hold values corresponding to member traits, whereas target hints hold values corresponding to normal data shapes.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Hints

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Hints.type
object JsConverters

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class Lazy[A](make: () => A)

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Lazy

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Lazy.type
abstract opaque class Newtype[A] extends HasId

Attributes

Companion
object
Supertypes
trait HasId
class Object
trait Matchable
class Any
Known subtypes
Self type
Newtype[A]
object Newtype

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Newtype.type
sealed trait Nullable[+A]

ADT isomorphic to Option, but representing types that were passed explicitly as null rather than ones that were absent.

ADT isomorphic to Option, but representing types that were passed explicitly as null rather than ones that were absent.

The goal of this datatype is to offer the ability to distinguish, during serialisation, between the absence of a field and the nullity of a field.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Null
class Value[A]
object Nullable

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Nullable.type
object NumericCompat

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait PartialData[A]

Data structure that can hold either the totality or a subset of a larger piece of data.

Data structure that can hold either the totality or a subset of a larger piece of data.

This can be used to reconcile bits of data that are coming from several locations, or to send a piece of data towards different locations.

For instance :

structure AB {
 @httpPayload
 @required
 a: String,

 @httpHeader("X-B")
 @required
 b: String
}

translates to this case class

 case class AB(a: String, b: String) 

.

However, codec derivation (performed by the SchemaVisitor mechanism in Smithy4s), does not let us easily solve for problem such as http message decoding, because of the notion of priority : the http body of a message should not be decoded if the metadata is not fully decoded first.

In order to solve for this, the PartialData type allows to momentarily store a subset of the fields of a case class so that it can be reconciled with other pieces of PartialData later on.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Partial[A]
class Total[A]
object PartialData

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
trait Protocol[A]

Attributes

Supertypes
class Object
trait Matchable
class Any
trait Refinement[A, B]

A type-refinement, associated to a runtime-representation of a constraint.

A type-refinement, associated to a runtime-representation of a constraint.

Represents the fact that you can go from A to B provided the value of tye A abides by a given Constraint.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type
Refinement[A, B]
object Refinement

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Refinement.type
trait RefinementProvider[C, A, B]

Given a constraint of type C, an RefinementProvider can produce a Refinement that allows to go from A to B.

Given a constraint of type C, an RefinementProvider can produce a Refinement that allows to go from A to B.

A RefinementProvider can be used as a typeclass.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait Service[Alg[_[_, _, _, _, _]]] extends FunctorK5[Alg], HasId

Generic representation of a service, as a list of "endpoints" (mapping to smithy operations).

Generic representation of a service, as a list of "endpoints" (mapping to smithy operations).

This abstraction lets us retrieve all information necessary to the generic implementation of protocols, as well as transform implementations of finally-encoded interfaces into interpreters (polymorphic functions) that operate on initially-encoded GADTs.

Type parameters

Alg:

a finally-encoded interface (commonly called algebra) that works against an abstract "effect" that takes 5 type parameters: Input, Error, Output, StreamedInput, StreamedOutput

Op:

an initially encoded version of the finally-encoded interface. Typically, a GADT that acts as a reification of the operations. Passing the reified versions around makes it drastically easier to implement logic generically, without involving metaprogramming.

Attributes

Companion
object
Supertypes
trait HasId
trait FunctorK5[Alg]
class Object
trait Matchable
class Any
Known subtypes
trait Mixin[Alg, Op]
trait Reflective[Op]
object Service

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Service.type
trait ServiceProduct[Prod[_[_, _, _, _, _]]] extends FunctorK5[Prod]

Something that returns a product of endpoints. Contains the same information as a service, with the difference that the algebra (the product type parameter) can be be an interface with methods without inputs.

Something that returns a product of endpoints. Contains the same information as a service, with the difference that the algebra (the product type parameter) can be be an interface with methods without inputs.

Type parameters

Prod

the product type parameter. For code generation this is also generated as an interface with methods without inputs (one for each endpoint). This has suffix ProductGen.

Attributes

Companion
object
Supertypes
trait FunctorK5[Prod]
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
final case class ShapeId(namespace: String, name: String) extends HasId

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait HasId
class Object
trait Matchable
class Any
Show all
object ShapeId extends Has[ShapeId]

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait Has[ShapeId]
class Object
trait Matchable
class Any
Show all
Self type
ShapeId.type
trait ShapeTag[A] extends HasId

A tag that can be used as keys for higher-kinded maps

A tag that can be used as keys for higher-kinded maps

Attributes

Companion
object
Supertypes
trait HasId
class Object
trait Matchable
class Any
Known subtypes
trait Companion[A]
object HttpBinding
object InputOutput
trait Companion[E]
trait Enumeration[E]
object Error
object Severity
object AcceptorState
object ProtoNumType
object AddedDefault
object Box
object Cors
object Deprecated
object Endpoint
object EventHeader
object EventPayload
object Example
object ExampleError
object HostLabel
object Http
object HttpBasicAuth
object HttpLabel
object HttpPayload
object IdRef
object Idempotent
object Input
object Internal
object Length
object Mixin
object NoReplace
object NotProperty
object OptionalAuth
object Output
object Paginated
object Private
object Property
object Range
object Readonly
object Recommended
object Reference
object Required
object Retryable
object Sensitive
object Sparse
object Streaming
object Trait
object TraitDiffRule
object UniqueItems
object Unit
object UnitType
object Unstable
object XmlAttribute
object XmlFlattened
object XmlNamespace
object Acceptor
object Matcher
object PathMatcher
object Waiter
object EmailFormat
object Grpc
object ProtoEnabled
object ProtoWrapped
object Range
object DataExample
object DateFormat
object Nullable
object OpenEnum
object Untagged
object UuidFormat
Show all
object ShapeTag

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ShapeTag.type
trait Smithy4sThrowable extends Throwable

Attributes

Supertypes
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Self type
Product
trait Surjection[A, B] extends A => Either[String, B]

A surjection of a partial function A => Either[String, B] and a total function B => A.

A surjection of a partial function A => Either[String, B] and a total function B => A.

A surjection MUST abide by the round-tripping property, namely, for all input A that passes the validation function

surjection(input).map(surjection.from) == Right(input)

Attributes

Companion
object
Supertypes
trait A => Either[String, B]
class Object
trait Matchable
class Any
Self type
Surjection[A, B]
object Surjection

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Surjection.type
case class Timestamp

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Timestamp

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Timestamp.type
trait Transformation[Func, Input, Output]

Heterogenous function construct, allows to abstract over various kinds of functions whilst providing an homogenous user experience without the user having to manually lift functions from one kind to the other.

Heterogenous function construct, allows to abstract over various kinds of functions whilst providing an homogenous user experience without the user having to manually lift functions from one kind to the other.

// assuming Foo is a code-generated interface
val fooOption: Foo[Option] = ???
val toList = new smithy4s.PolyFunction[Option, List]{def apply[A](fa: Option[A]): List[A] = fa.toList}
val fooList: Foo[List] = foo.transform(toList)

It is possible to plug arbitrary transformations to mechanism, such as cats.arrow.FunctionK

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
final case class UnsupportedProtocolError(service: HasId, protocolTag: HasId) extends Throwable

Attributes

Supertypes
trait Product
trait Equals
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Types

type Hint = Binding
type Schema[A] = Schema[A]
type ~>[F[_], G[_]] = PolyFunction[F, G]

Value members

Concrete methods

def checkProtocol[Alg[_[_, _, _, _, _]]](service: Service[Alg], protocolTag: ShapeTag[_]): Either[UnsupportedProtocolError, Unit]

Concrete fields

val Schema: Schema.type