SchemaCompanionMacros

class Object
trait Matchable
class Any
object Schema.type

Value members

Concrete methods

inline def derivedEnumeration[T](encode: Option[T => Any], schemaType: SchemaType[T], default: Option[T]): Schema[T]

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 be objects.

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 be objects.

Value parameters:
encode

Specify how values of this type can be encoded to a raw value (typically a String; the raw form should correspond with schemaType). This encoding will be used when generating documentation.

schemaType

The low-level representation of the enumeration. Defaults to a string.

inline def oneOfUsingField[E, V](inline extractor: E => V, asString: V => String)(mapping: (V, Schema[_])*)(implicit conf: Configuration): Schema[E]
inline def schemaForMap[K, V : Schema](keyToString: K => String): Schema[Map[K, V]]

Create a schema for a map with arbitrary keys. The schema for the keys (Schema[K]) should be a string (that is, the schema type should be sttp.tapir.SchemaType.SString), however this cannot be verified at compile-time and is not verified at run-time.

Create a schema for a map with arbitrary keys. The schema for the keys (Schema[K]) should be a string (that is, the schema type should be sttp.tapir.SchemaType.SString), 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)

Inherited methods

inline def derived[T](using genericDerivationConfig: Configuration, m: Of[T]): Schema[T]

Implicits

Implicits

implicit inline def derivedEnumerationValue[T <: Value]: Schema[T]

Create a schema for scala Enumeration and the Validator instance based on possible enumeration values

Create a schema for scala Enumeration and the Validator instance based on possible enumeration values

implicit inline def schemaForMap[V : Schema]: Schema[Map[String, V]]