trait SchemaCompanionMacros extends SchemaMagnoliaDerivation
- Alphabetic
- By Inheritance
- SchemaCompanionMacros
- SchemaMagnoliaDerivation
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- type Typeclass[T] = Schema[T]
- Definition Classes
- SchemaMagnoliaDerivation
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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- macro def derived[T]: Schema[T]
- macro def derivedEnumeration[T]: CreateDerivedEnumerationSchema[T]
Creates a schema for an enumeration, where the validator is derived using sttp.tapir.Validator.derivedEnumeration.
Creates a schema for an enumeration, where the validator is derived using sttp.tapir.Validator.derivedEnumeration. This requires that all subtypes of the sealed hierarchy
T
must beobject
s.This method cannot be implicit, as there's no way to constraint the type
T
to be a sealed trait / class enumeration, so that this would be invoked only when necessary. - implicit macro def derivedEnumerationValue[T <: Value]: Schema[T]
Create a schema for an Enumeration, where the validator is created using the enumeration's values.
Create a schema for an Enumeration, where the validator is created using the enumeration's values. The low-level representation of the enum is a
String
, and the enum values in the documentation will be encoded using.toString
. - macro def derivedEnumerationValueCustomise[T <: Value]: CreateDerivedEnumerationSchema[T]
Creates a schema for an Enumeration, where the validator is created using the enumeration's values.
Creates a schema for an Enumeration, where the validator is created using the enumeration's values. Unlike the default derivedEnumerationValue method, which provides the schema implicitly, this variant allows customising how the schema is created. This is useful if the low-level representation of the schema is different than a
String
, or if the enumeration's values should be encoded in a different way than using.toString
.Because of technical limitations of macros, the customisation arguments can't be given here directly, instead being delegated to CreateDerivedEnumerationSchema.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def join[T](ctx: ReadOnlyCaseClass[Schema, T])(implicit genericDerivationConfig: Configuration): Schema[T]
- Definition Classes
- SchemaMagnoliaDerivation
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- macro def oneOfUsingField[E, V](extractor: (E) => V, asString: (V) => String)(mapping: (V, Schema[_])*)(implicit conf: Configuration, discriminatorSchema: Schema[V]): Schema[E]
Create a coproduct schema (e.g.
Create a coproduct schema (e.g. for a
sealed trait
), where the value of the discriminator between child types is a read of a field of the base type. The field, if not yet present, is added to each child schema.The schemas of the child types have to be provided explicitly with their value mappings in
mapping
.Note that if the discriminator value is some transformation of the child's type name (obtained using the implicit Configuration), the coproduct schema can be derived automatically or semi-automatically.
- discriminatorSchema
The schema that is used when adding the discriminator as a field to child schemas (if it's not yet in the schema).
- macro def oneOfWrapped[E](implicit conf: Configuration): Schema[E]
Create a coproduct schema for a
sealed trait
orsealed abstract class
, where to discriminate between child types a wrapper product is used.Create a coproduct schema for a
sealed trait
orsealed abstract class
, where to discriminate between child types a wrapper product is used. The name of the sole field in this product corresponds to the type's name, transformed using the implicit Configuration. - macro def schemaForMap[K, V](keyToString: (K) => String)(implicit arg0: Schema[V]): Schema[Map[K, V]]
Create a schema for a map with arbitrary keys.
Create a schema for a map with arbitrary keys. The schema for the keys
K
should be a string, however this cannot be verified at compile-time and is not verified at run-time.The given
keyToString
conversion function is used during validation.If you'd like this schema to be available as an implicit for a given type of keys, create an custom implicit, e.g.:
case class MyKey(value: String) extends AnyVal implicit val schemaForMyMap = Schema.schemaForMap[MyKey, MyValue](_.value)
- implicit macro def schemaForMap[V](implicit arg0: Schema[V]): Schema[Map[String, V]]
- def split[T](ctx: SealedTrait[Schema, T])(implicit genericDerivationConfig: Configuration): Schema[T]
- Definition Classes
- SchemaMagnoliaDerivation
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- 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
(Since version 9)