Schema

smithy4s.schema.Schema
See theSchema companion object
sealed trait Schema[A]

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class BijectionSchema[A, B]
class CollectionSchema[C, A]
class LazySchema[A]
class MapSchema[K, V]
class OptionSchema[A]
class PrimitiveSchema[P]
class RefinementSchema[A, B]
class StructSchema[S]
class UnionSchema[U]
Show all

Members list

Value members

Abstract methods

def hints: Hints

Concrete methods

final def addHints(hints: Hint*): Schema[A]
final def addHints(hints: Hints): Schema[A]
final def addMemberHints(hints: Hint*): Schema[A]
final def addMemberHints(hints: Hints): Schema[A]
final def biject[B](bijection: Bijection[A, B]): Schema[B]
final def biject[B](to: A => B)(from: B => A): Schema[B]
final def compile[F[_]](fk: PolyFunction[Schema, F]): F[A]
final def error(unlift: A => Throwable)(lift: PartialFunction[Throwable, A]): ErrorSchema[A]

Turns this schema into an error schema.

Turns this schema into an error schema.

Attributes

final def field[Struct]: PartiallyAppliedField[Struct, A]
final def findPayload(find: Field[_, _] => Boolean): SchemaPartition[A]

Finds the first field that matches the criteria used, and applies a bijection between the schema it holds and partial data, which ensures for the field's schema to be used as "top level" when decoding "payloads".

Finds the first field that matches the criteria used, and applies a bijection between the schema it holds and partial data, which ensures for the field's schema to be used as "top level" when decoding "payloads".

NB : a "payload" is typically a whole set of data, without a typical field-based splitting into subparts. This can be, for instance, an http body.

Attributes

final def getDefault: Option[Document]
final def getDefaultValue: Option[A]
final def isOption: Boolean
final def isPrimitive[P](prim: Primitive[P]): Boolean

Finds whether a schema (or the underlying schema in the case of bijections/surjections, etc) is a primitive of a certain type.

Finds whether a schema (or the underlying schema in the case of bijections/surjections, etc) is a primitive of a certain type.

Attributes

final def isUnit: Boolean

Checks whether a schema is Unit or an empty structure

Checks whether a schema is Unit or an empty structure

Attributes

final def oneOf[Union]: PartiallyAppliedOneOf[Union, A]
final def option: Schema[Option[A]]
final def optional[Struct]: PartiallyAppliedOptional[Struct, A]
final def partition(filter: Field[_, _] => Boolean): SchemaPartition[A]

When applied on a structure schema, creates a schema that, when compiled into a codec, will only encode/decode a subset of the data, based on the hints of each field.

When applied on a structure schema, creates a schema that, when compiled into a codec, will only encode/decode a subset of the data, based on the hints of each field.

This can be used to only encode some fields of the data into the http body

Returns a SchemaPartition that indicates whether :

  • no field match the condition
  • some fields match the condition
  • all fields match the condition

Attributes

final def refined[B]: PartiallyAppliedRefinement[A, B]
final def required[Struct]: PartiallyAppliedRequired[Struct, A]
final def transformHintsLocally(f: Hints => Hints): Schema[A]
final def validated[C](c: C)(implicit constraint: Simple[C, A]): Schema[A]
final def withId(newId: ShapeId): Schema[A]
final def withId(namespace: String, name: String): Schema[A]