Schema

morphling.Schema$
object Schema

Data types and smart constructors which simplify the creation of schema values.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Schema.type

Members list

Type members

Classlikes

final class AbsentBuilder[P[_]]

Builder class used to construct a Absent property

Builder class used to construct a Absent property

Attributes

Supertypes
class Object
trait Matchable
class Any
final class ConstantBuilder[P[_]]

Builder class used to construct a Constant property

Builder class used to construct a Constant property

Attributes

Supertypes
class Object
trait Matchable
class Any

Types

type Prop[P[_], O, I] = FreeApplicative[[_] =>> PropSchema[O, [_] =>> Schema[P, _$4], _$5], I]

The type of free applicative values which are used to capture the structure of individual record properties.

The type of free applicative values which are used to capture the structure of individual record properties.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

O

The type of a Scala record - an object or a tuple, the property of which is being defined.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Attributes

type Props[P[_], R] = Prop[P, R, R]

The type of free applicative values which are used to capture the structure of record (product) types.

The type of free applicative values which are used to capture the structure of record (product) types.

Type parameters

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

R

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. This is usually the type of a record - an object or a tuple.

Attributes

type Schema[P[_], I] = HFix[[Y[_], Z] =>> SchemaF[P, Y, Z], I]

The type of an unannotated schema.

The type of an unannotated schema.

This is an alias for the HFix fixpoint applied to the SchemaF type constructor.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Attributes

Value members

Concrete methods

def absent[P[_]]: AbsentBuilder[P]

Smart constructor for absent Prop instances.

Smart constructor for absent Prop instances.

Type parameters

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Attributes

def alt[P[_], I, J](id: String, base: Schema[P, J], subset: Subset[I, J]): Alt[[_] =>> Schema[P, _$58], I, J]

Convenience constructor for oneOf schema alternatives.

Convenience constructor for oneOf schema alternatives.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

J

The type of the base value which can be mapped into the I algebra.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Value parameters

base

The schema for the J type

id

The unique identifier of the constructor

subset

Prism between the sum type and the selected constructor.

Attributes

def const[P[_], O](obj: O): Schema[P, O]

The unannotated empty record schema, representing a constant value.

The unannotated empty record schema, representing a constant value.

Type parameters

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Attributes

def constant[P[_]]: ConstantBuilder[P]

Smart constructor for constant Prop instances.

Smart constructor for constant Prop instances.

Type parameters

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Attributes

def hfmapAlg[P[_], Q[_]](nt: FunctionK[P, Q]): FunctionK[[_] =>> SchemaF[P, [_] =>> Schema[Q, _$62], _$63], [_] =>> Schema[Q, _$64]]

HAlgebra for primitive type constructor transformation.

HAlgebra for primitive type constructor transformation.

Attributes

def optional[P[_], O, I, OI <: Option[I]](fieldName: String, valueSchema: Schema[P, I], extract: Extract[O, OI]): Prop[P, O, Option[I]]

Smart constructor for optional Prop instances.

Smart constructor for optional Prop instances.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

O

The type of a Scala record - an object or a tuple, the property of which is being defined.

OI

hack for proper overload resolution

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Value parameters

extract

Extract lens from the record type to the property's value

fieldName

name of the record property

valueSchema

schema for the record property's type

Attributes

def optional[P[_], O, I](fieldName: String, valueSchema: Schema[P, I], property: Property[O, I]): Prop[P, O, Option[I]]

Smart constructor for optional Prop instances.

Smart constructor for optional Prop instances.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

O

The type of a Scala record - an object or a tuple, the property of which is being defined.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Value parameters

fieldName

name of the record property

property

Property lens from the record type to the property's value

valueSchema

schema for the record property's type

Attributes

def prim[P[_], I](p: P[I]): Schema[P, I]

Lifts a value in an algebra of primitives into an unannotated Schema

Lifts a value in an algebra of primitives into an unannotated Schema

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Value parameters

p

a value of the P algebra

Attributes

Returns

the newly constructed schema value

def property[P[_], O, I](fieldName: String, valueSchema: Schema[P, I], default: I, extract: Extract[O, I]): Prop[P, O, I]

Smart constructor for required Prop instances, with a default provided for the case where a serialized form is missing the required field.

Smart constructor for required Prop instances, with a default provided for the case where a serialized form is missing the required field.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

O

The type of a Scala record - an object or a tuple, the property of which is being defined.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Value parameters

default

Default value for use in the case that a serialized form is missing the required field.

extract

Extract lens from the record type to the property's value

fieldName

Name of the record property

valueSchema

Schema for the record property's type

Attributes

def rec[P[_], I](props: Props[P, I]): Schema[P, I]

Builds an un-annotated schema for a record type from the free applicative capture of that record's structure.

Builds an un-annotated schema for a record type from the free applicative capture of that record's structure.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Value parameters

props

The free-applicative value that captures the structure of the record type.

Attributes

def required[P[_], O, I](fieldName: String, valueSchema: Schema[P, I], extract: Extract[O, I]): Prop[P, O, I]

Smart constructor for required Prop instances.

Smart constructor for required Prop instances.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

O

The type of a Scala record - an object or a tuple, the property of which is being defined.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Value parameters

extract

Extract lens from the record type to the property's value

fieldName

name of the record property

valueSchema

schema for the record property's type

Attributes

def schema[P[_], I](sf: => SchemaF[P, [_] =>> Schema[P, _$16], I]): Schema[P, I]

Lifts a SchemaF value into an unannotated Schema

Lifts a SchemaF value into an unannotated Schema

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Value parameters

sf

The value to be annotated

Attributes

Returns

the newly constructed schema value

def unsafeOneOf[P[_], I](alts: NonEmptyList[Alt[[_] =>> Schema[P, _$52], I, _]]): Schema[P, I]

Builds an un-annotated schema for the sum type I from a list of alternatives.

Builds an un-annotated schema for the sum type I from a list of alternatives.

Each alternative value in the list describes a single constructor of I. For example, to construct the schema for scala.util.Either one would provide two alternatives, one for the Left constructor and one for Right.

This convenience constructor is unsafe in that the compiler will not prove that handling is present for every constructor of your sum type; however, it may sometimes be needed in the case that failures of the Scala compiler to correctly identify all the constructors of a sum type make it otherwise impossible to build a schema value.

Type parameters

I

The type of the Scala value to be produced (or consumed) by an interpreter of the schema. Also known as the "index" type of the schema.

P

The GADT type constructor for a sum type which defines the set of primitive types used in the schema.

Attributes

def unsafeOneOfDiscr[P[_], I](discriminatorField: String)(alts: NonEmptyList[Alt[[_] =>> Schema[P, _$55], I, _]]): Schema[P, I]

Givens

Givens

given given_Applicative_Prop[P[_], O]: Applicative[[_] =>> Prop[P, O, _$7]]
given given_Profunctor_Prop[P[_]]: Profunctor[[Y, Z] =>> Prop[P, Y, Z]]

Extensions

Extensions

extension [P[_], I](base: Schema[P, I])(base: Schema[P, I])
def composeIso[J](eqv: Equivalent[I, J]): Schema[P, J]