Skip to main content

Module schema

Module schema 

Source
Expand description

Schema definitions for fuzzy repair

This module provides schema types that callers use to define valid field names, type discriminators, and expected value shapes for fuzzy matching and coercion.

§Design

Schemas are built from three layers:

  • FieldKind — the expected shape of a single field value (enum set, nested object, coercion target, …). Nested kinds make the schema recursive: objects inside arrays inside objects can all be described and repaired.
  • ObjectSchema — a set of named fields (FieldDef) for one object.
  • TaggedEnumSchema — a discriminated union: a tag field selects which ObjectSchema applies.

All schema types own their strings, so schemas can be built at runtime (e.g. from a config file or an API definition), not only from 'static literals.

Structs§

FieldDef
A named field with an expected value shape.
ObjectSchema
Schema for an object with known fields.
TaggedEnumSchema
Schema for a tagged enum (discriminated union)

Enums§

FieldKind
Expected shape of a single field value.