object Schema extends LowPrioritySchema with SchemaCompanionMacros with Serializable
- Alphabetic
- By Inheritance
- Schema
- Serializable
- Serializable
- SchemaCompanionMacros
- SchemaMagnoliaDerivation
- LowPrioritySchema
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
Delimiter(delimiter: String) extends Product with Serializable
Used in combination with explode, to properly represent delimited values in examples and default values (#3581)
-
case class
Explode(explode: Boolean) extends Product with Serializable
Corresponds to OpenAPI's
explode
parameter which should be used for delimited values. -
case class
SName(fullName: String, typeParameterShortNames: List[String] = Nil) extends Product with Serializable
- typeParameterShortNames
full name of type parameters, name is legacy and kept only for backward compatibility
-
case class
Title(value: String) extends Product with Serializable
Corresponds to JsonSchema's
title
parameter which should be used for defining title of the object. -
type
Typeclass[T] = Schema[T]
- Definition Classes
- SchemaMagnoliaDerivation
- case class UniqueItems(uniqueItems: Boolean) extends Product with Serializable
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
- val ModifyCollectionElements: String
-
def
any[T]: Schema[T]
A schema allowing anything: a number, string, object, etc.
A schema allowing anything: a number, string, object, etc. A SCoproduct with no specified subtypes.
- See also
-
def
anyObject[T]: Schema[T]
A schema allowing any object.
A schema allowing any object. A SProduct with no specified fields.
- See also
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
binary[T]: Schema[T]
Creates a schema for type
T
, where the low-level representation is binary. -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
macro
def
derived[T]: Schema[T]
- Definition Classes
- SchemaCompanionMacros
-
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.- Definition Classes
- SchemaCompanionMacros
-
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
.- Definition Classes
- SchemaCompanionMacros
-
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.
- Definition Classes
- SchemaCompanionMacros
-
implicit
def
derivedSchema[T](implicit derived: Derived[Schema[T]]): Schema[T]
- Definition Classes
- LowPrioritySchema
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
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
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
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).
- Definition Classes
- SchemaCompanionMacros
-
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.- Definition Classes
- SchemaCompanionMacros
- implicit def schemaForArray[T](implicit arg0: Schema[T]): Schema[Array[T]]
- implicit val schemaForBigDecimal: Schema[BigDecimal]
- implicit val schemaForBigInt: Schema[BigInt]
- implicit val schemaForBoolean: Schema[Boolean]
- implicit val schemaForByte: Schema[Byte]
- implicit val schemaForByteArray: Schema[Array[Byte]]
- implicit val schemaForByteBuffer: Schema[ByteBuffer]
- implicit val schemaForDate: Schema[Date]
- implicit def schemaForDelimited[D <: String, T](implicit tSchema: Schema[T]): Schema[Delimited[D, T]]
- implicit val schemaForDouble: Schema[Double]
- implicit def schemaForEither[A, B](implicit sa: Schema[A], sb: Schema[B]): Schema[Either[A, B]]
- implicit val schemaForFile: Schema[tapir.TapirFile]
- implicit val schemaForFileRange: Schema[FileRange]
- implicit val schemaForFloat: Schema[Float]
- implicit val schemaForInputStream: Schema[InputStream]
- implicit val schemaForInputStreamRange: Schema[InputStreamRange]
- implicit val schemaForInstant: Schema[Instant]
- implicit val schemaForInt: Schema[Int]
- implicit def schemaForIterable[T, C[X] <: Iterable[X]](implicit arg0: Schema[T]): Schema[C[T]]
- implicit val schemaForJBigDecimal: Schema[BigDecimal]
- implicit val schemaForJBigInteger: Schema[BigInteger]
- implicit val schemaForJavaDuration: Schema[Duration]
- implicit val schemaForLocalDate: Schema[LocalDate]
- implicit val schemaForLocalDateTime: Schema[LocalDateTime]
- implicit val schemaForLocalTime: Schema[LocalTime]
- implicit val schemaForLong: Schema[Long]
-
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)
- Definition Classes
- SchemaCompanionMacros
-
implicit macro
def
schemaForMap[V](implicit arg0: Schema[V]): Schema[Map[String, V]]
- Definition Classes
- SchemaCompanionMacros
- implicit val schemaForOffsetDateTime: Schema[OffsetDateTime]
- implicit val schemaForOffsetTime: Schema[OffsetTime]
- implicit def schemaForOption[T](implicit arg0: Schema[T]): Schema[Option[T]]
- implicit def schemaForPart[T](implicit arg0: Schema[T]): Schema[Part[T]]
- implicit val schemaForScalaDuration: Schema[Duration]
- implicit def schemaForSet[T, C[X] <: Set[X]](implicit arg0: Schema[T]): Schema[C[T]]
- implicit val schemaForShort: Schema[Short]
- implicit val schemaForString: Schema[String]
- implicit val schemaForUUID: Schema[UUID]
- implicit val schemaForUnit: Schema[Unit]
- implicit val schemaForUri: Schema[Uri]
- implicit val schemaForZoneId: Schema[ZoneId]
- implicit val schemaForZoneOffset: Schema[ZoneOffset]
- implicit val schemaForZonedDateTime: Schema[ZonedDateTime]
-
def
split[T](ctx: SealedTrait[Schema, T])(implicit genericDerivationConfig: Configuration): Schema[T]
- Definition Classes
- SchemaMagnoliaDerivation
-
def
string[T]: Schema[T]
Creates a schema for type
T
, where the low-level representation is aString
. -
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( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
wrapWithSingleFieldProduct[T](schema: Schema[T])(implicit conf: Configuration): Schema[T]
Wraps the given schema with a single-field product, where a field computed using the implicit Configuration maps to
schema
.Wraps the given schema with a single-field product, where a field computed using the implicit Configuration maps to
schema
.The resulting schema has no name.
Useful when generating one-of schemas for coproducts, where to discriminate between child types a wrapper product is used. To automatically derive such a schema for a sealed hierarchy, see Schema.oneOfWrapped.
-
def
wrapWithSingleFieldProduct[T](schema: Schema[T], fieldName: FieldName): Schema[T]
Wraps the given schema with a single-field product, where
fieldName
maps toschema
.Wraps the given schema with a single-field product, where
fieldName
maps toschema
.The resulting schema has no name.
Useful when generating one-of schemas for coproducts, where to discriminate between child types a wrapper product is used. To automatically derive such a schema for a sealed hierarchy, see Schema.oneOfWrapped.
- object Delimiter extends Serializable
- object Explode extends Serializable
- object SName extends Serializable
- object Title extends Serializable
- object UniqueItems extends Serializable
-
object
annotations
Annotations which are used during automatic schema derivation, or semi-automatic schema derivation using Schema.derived.
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated