Expand description
Conversion from EureDocument to SchemaDocument
This module provides functionality to convert Eure documents containing schema definitions into SchemaDocument structures.
§Schema Syntax
Schema types are defined using the following syntax:
Primitives (shorthands via inline code):
`text`,`integer`,`float`,`boolean`,`null`,`any``text.rust`,`text.email`,`text.plaintext`
Primitives with constraints:
@ field {
$variant = "text"
min-length = 3
max-length = 20
pattern = `^[a-z]+$`
}Array: [`text`] or { $variant = "array", item = `text`, ... }
Tuple: (`text`, `integer`) or { $variant = "tuple", elements = [...] }
Record: { name = `text`, age = `integer` }
Union with named variants:
@ field {
$variant = "union"
variants.success = { data = `any` }
variants.error = { message = `text` }
variants.error.$ext-type.unambiguous = true // optional, for catch-all variants
$interop.variant-repr = "untagged" // optional
}Literal: Any constant value (e.g., { = "active", $variant = "literal" }, 42, true)
Type reference: `$types.my-type` or `$types.namespace.type`
Structs§
- Schema
Source - Source document location for a schema node.
Enums§
- Conversion
Error - Errors that can occur during document to schema conversion
Functions§
- document_
to_ schema - Backwards-compatible single-document entry point.
$importentries require a pre-loaded graph. - document_
to_ schema_ with_ layout - Backwards-compatible single-document entry point.
$importentries require a pre-loaded graph, so useloaded_schema_set_to_schema_with_layoutfor import support. - loaded_
schema_ set_ to_ schema - Convert a pre-loaded schema import graph to a schema.
- loaded_
schema_ set_ to_ schema_ with_ layout - Convert a pre-loaded schema import graph and compute its layout strategies.
Type Aliases§
- Schema
Source Map - Mapping from schema node IDs to their source document node IDs. Used for propagating origin information for error formatting.