Type

sealed interface Type

The type system for the IDL.

Inheritors

Types

Link copied to clipboard
data object Bool : Type

A boolean type.

Link copied to clipboard
data class Decimal(val min: BigInteger, val max: BigInteger, val scale: Int, val rounding: Type.Decimal.Rounding = Rounding.TOWARDS_ZERO, val overflow: Type.Decimal.Overflow = Overflow.ERROR) : Type

A decimal type. min and max are inclusive unscaled big integers, allowing for easier comparison with the unscaled value of a decimal.

Link copied to clipboard
data class Map(val keys: Type, val values: Type) : Type

A map type. Analogous to kotlin.collections.Map.

Link copied to clipboard
data class Option(val inner: Type) : Type

An option type (nullability). Allows for nested nullability.

Link copied to clipboard
data class Ref(val name: String) : Type
Link copied to clipboard
data class Seq(val inner: Type) : Type

A sequence type. Analogous to List.

Link copied to clipboard
data class Str(val maxLen: Long = Long.MAX_VALUE) : Type

A string type. Max length is defined, as the JVM defines it, through UTF-16 length.

Link copied to clipboard
data object Void : Type

A void type. Analogous to Unit.

Properties

Link copied to clipboard
abstract val kind: String

Functions

Link copied to clipboard
infix fun Type.accepts(v: Value): Boolean

Convenience method to check a value against a type with no named declarations, ignoring the specifications of mismatches.

fun Type.accepts(v: Value, schema: Schema): Boolean

Convenience method to check a value against a type, ignoring the specifications of mismatches.

Link copied to clipboard
infix fun Type.check(v: Value): List<Mismatch>

Check a value against a type with no named declarations to resolve against.

fun Type.check(v: Value, schema: Schema): List<Mismatch>

Check a value against a type, resolving any Type.Ref through schema.

Link copied to clipboard