case class Schema[T](schemaType: SchemaType[T], name: Option[SName] = None, isOptional: Boolean = false, description: Option[String] = None, default: Option[(T, Option[Any])] = None, format: Option[String] = None, encodedExample: Option[Any] = None, deprecated: Boolean = false, hidden: Boolean = false, validator: Validator[T] = Validator.pass[T], attributes: AttributeMap = AttributeMap.Empty) extends SchemaMacros[T] with Product with Serializable
Describes the type T
: its low-level representation, meta-data and validation rules.
- format
The name of the format of the low-level representation of
T
.
- Annotations
- @implicitNotFound()
- Alphabetic
- By Inheritance
- Schema
- Serializable
- Product
- Equals
- SchemaMacros
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Schema(schemaType: SchemaType[T], name: Option[SName] = None, isOptional: Boolean = false, description: Option[String] = None, default: Option[(T, Option[Any])] = None, format: Option[String] = None, encodedExample: Option[Any] = None, deprecated: Boolean = false, hidden: Boolean = false, validator: Validator[T] = Validator.pass[T], attributes: AttributeMap = AttributeMap.Empty)
- format
The name of the format of the low-level representation of
T
.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def applyValidation(t: T): List[ValidationError[_]]
Apply defined validation rules to the given value.
- def as[TT]: Schema[TT]
Adapt this schema to type
TT
.Adapt this schema to type
TT
. Only the meta-data is retained, except for default values and the validator (however, product field/subtypes validators are retained). Run-time functionality:- traversing collection elements, product fields, or coproduct subtypes
- validating an instance of type
TT
the top-level type is lost.
- def asArray: Schema[Array[T]]
Returns an array version of this schema, with the schema type wrapped in SArray.
Returns an array version of this schema, with the schema type wrapped in SArray. Sets
isOptional
to true as the collection might be empty. - final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asIterable[C[X] <: Iterable[X]]: Schema[C[T]]
Returns a collection version of this schema, with the schema type wrapped in SArray.
Returns a collection version of this schema, with the schema type wrapped in SArray. Sets
isOptional
to true as the collection might be empty. - def asOption: Schema[Option[T]]
Returns an optional version of this schema, with
isOptional
set to true. - def attribute[A](k: AttributeKey[A], v: A): Schema[T]
- def attribute[A](k: AttributeKey[A]): Option[A]
- val attributes: AttributeMap
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def default(t: T, encoded: Option[Any] = None): Schema[T]
Adds a default value, which is used by Codec s during decoding and for documentation.
Adds a default value, which is used by Codec s during decoding and for documentation.
To represent the value in the documentation, an encoded form needs to be provided. The encoded form is inferred if missing and the given value is of a basic type (number, string, etc.).
- val default: Option[(T, Option[Any])]
- def deprecated(d: Boolean): Schema[T]
- val deprecated: Boolean
- def description(d: String): Schema[T]
- val description: Option[String]
- def encodedExample(e: Any): Schema[T]
- val encodedExample: Option[Any]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def format(f: String): Schema[T]
- val format: Option[String]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hidden(h: Boolean): Schema[T]
- val hidden: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val isOptional: Boolean
- def map[TT](f: (T) => Option[TT])(g: (TT) => T): Schema[TT]
- macro def modify[U](path: (T) => U)(modification: (Schema[U]) => Schema[U]): Schema[T]
Modifies nested schemas for case classes and case class families (sealed traits / enums), accessible with
path
, using the givenmodification
function.Modifies nested schemas for case classes and case class families (sealed traits / enums), accessible with
path
, using the givenmodification
function. To traverse collections, use.each
.Should only be used if the schema hasn't been created by
.map
ping another one. In such a case, the shape of the schema doesn't correspond to the typeT
, but to some lower-level representation of the type.If the shape of the schema doesn't correspond to the path, the schema remains unchanged.
- Definition Classes
- SchemaMacros
- def modifyUnsafe[U](fields: String*)(modify: (Schema[U]) => Schema[U]): Schema[T]
See modify: instead of a path expressed using code, accepts a path a sequence of
String
s. - def name(name: Option[SName]): Schema[T]
- def name(name: SName): Schema[T]
- val name: Option[SName]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- val schemaType: SchemaType[T]
- def show: String
- def showValidators: Option[String]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def title(t: String): Schema[T]
- def validate(v: Validator[T]): Schema[T]
Add a validator to this schema.
Add a validator to this schema. If the validator contains a named enum validator:
- the encode function is inferred if not yet defined, and the validators possible values are of a basic type
- the name is set as the schema's name.
- val validator: Validator[T]
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated