Primitive

zio.blocks.schema.comptime.Allows.Primitive
See thePrimitive companion object
sealed abstract class Primitive extends Structural

Catch-all grammar node: matches any of the 30 Schema primitive types.

For stricter control, use the type aliases in Primitive.Int, Primitive.String, etc. — each is defined as IsType[X] for the corresponding Scala/Java type, and is handled by the same IsType macro path. A type that satisfies Primitive.Int also satisfies Primitive via the union check; no special subtype relationship is required.

import zio.blocks.schema.comptime.Allows._

// Allow only JSON-representable numbers:
type JsonNumber = Primitive.Int | Primitive.Long | Primitive.Double

// Allow any primitive (the traditional usage):
type AnyPrim = Primitive

In Scala 2 you may also write Primitive.Int `|` Primitive.Long.

Attributes

Companion
object
Source
Allows.scala
Graph
Supertypes
class Structural
class Object
trait Matchable
class Any
In this article