Schema
Start here
Section titled “Start here”schemaCreates a schema token that parses a JSON object field-by-field using the provided descriptor map.modelCreates an extendable schema token for naming and authoring model classes.strString primitive with optional chainable length and pattern constraints.intInteger primitive.SchemaTokenRepresents a typeTthat can be parsed from JSON input.compileSerializerCompiles a fast JSON serializer from a schema token.toJsonSchemaConverts a schema token into a JSON Schema Draft 7 object.
Functions
Section titled “Functions”arrayCreates a primitive that splits a comma-separated string (or maps over a pre-split string array) and parses each item using the providedprimitive.compileSerializerCompiles a fast JSON serializer from a schema token.defaultToWraps a primitive so that missing or empty-string inputs producefallbackinstead.enumsCreates a primitive that accepts any string value present in the provided tuple.modelCreates an extendable schema token for naming and authoring model classes.optionalWraps a primitive to accept missing or empty-string inputs, mapping them toundefined.schemaCreates a schema token that parses a JSON object field-by-field using the provided descriptor map.toJsonSchemaConverts a schema token into a JSON Schema Draft 7 object.
ArrayTypedPrimitiveArray-accepting primitive parser that splits a comma-separated string or maps over an existing string array.DescriptorValueAccepted value types for a single field within a schema descriptor.FieldErrorSingle field-level parse error reported by SchemaToken.safeParse.JsonObjectJSON object with string keys and JsonValue values.JsonSchemaThe JSON Schema fragment shape toJsonSchema produces.JsonValueAny value that can appear in a JSON payload.OpaqueSchemaTokenRuntime token representing a schema, with its value type erased.PrimitiveOpaque reference to a primitive parser.PrimitiveJsonSchemaJSON Schema fragment describing the constraints of a single primitive.SafeParseResultResult of a schema parse operation.SchemaErrorCollection of field-level errors produced by a failed schema parse.SchemaSerializerA compiled function serializing a JSON value that matches its source schema token.SchemaTokenRepresents a typeTthat can be parsed from JSON input.TypedPrimitiveCarries the output type alongside the primitive parser.
Constants
Section titled “Constants”boolBoolean primitive.dateemailEmail address primitive.floatFloating-point number primitive with optional chainable range constraints.intInteger primitive.strString primitive with optional chainable length and pattern constraints.textText primitive with optional chainable length and pattern constraints.urlURL primitive.uuidUUID v4 primitive.