Skip to content

covenix / SchemaNode

Type Alias: SchemaNode

SchemaNode = { id: string; kind: "ref"; } | { format?: string; kind: "string"; maxLength?: number; minLength?: number; pattern?: string; } | { exclusiveMaximum?: number; exclusiveMinimum?: number; int?: boolean; kind: "number"; maximum?: number; minimum?: number; multipleOf?: number; } | { kind: "boolean"; } | { kind: "literal"; values: (string | number | boolean | null)[]; } | { kind: "enum"; values: (string | number)[]; } | { additionalProperties?: SchemaNode | false; description?: string; kind: "object"; properties: Record<string, PropertyNode>; } | { element: SchemaNode; kind: "array"; maxItems?: number; minItems?: number; } | { items: SchemaNode[]; kind: "tuple"; rest?: SchemaNode; } | { kind: "union"; variants: SchemaNode[]; } | { discriminator: string; kind: "discriminatedUnion"; variants: SchemaNode[]; } | { key: SchemaNode; kind: "record"; value: SchemaNode; } | { inner: SchemaNode; kind: "nullable"; } | { inner: SchemaNode; kind: "optional"; } | { inner: SchemaNode; kind: "default"; value: unknown; } | { kind: "date"; } | { kind: "file"; } | { kind: "null"; } | { kind: "unknown"; } | { kind: "any"; } | { jsonSchema: unknown; kind: "unsupported"; }

Defined in: src/contract.ts:31

A node in the contract's schema tree (see SchemaNodeSchema for the runtime validator). Intentionally not JSON Schema: date/file are real kinds, discriminated unions are first-class, and object optionality is per-property. Constructs the v1 set doesn't model become an unsupported node that embeds JSON Schema, so nothing is silently lost.