pub enum TypeDef {
Primitive(PrimitiveType),
Object(ObjectType),
Array(ArrayType),
EnumString(EnumStringType),
EnumInt(EnumIntType),
EnumBool(EnumBoolType),
EnumNumber(EnumNumberType),
Union(UnionType),
Null,
Any,
}Variants§
Primitive(PrimitiveType)
Object(ObjectType)
Array(ArrayType)
EnumString(EnumStringType)
EnumInt(EnumIntType)
EnumBool(EnumBoolType)
A boolean-typed single-value (const) or closed set (enum). JSON
Schema const: true lowers here with one value; a future
enum: [true, false] would carry both. See issue #107.
EnumNumber(EnumNumberType)
A number-typed (non-integer) single-value (const) or closed set.
JSON Schema const: 1.5 lowers here. Integer consts/enums stay on
TypeDef::EnumInt; this variant covers number-typed literals.
Union(UnionType)
Null
JSON’s null as a unit type. The canonical singleton lives in
crate::Ir::types under id NULL_ID; T | null is expressed
as a UnionType whose variants list contains a Null reference
(canonicalized to last). See issue #107.
Any
The JSON Schema “any” schema — an empty/freeform schema ({}) or the
boolean schema true. It validates any instance (object, array,
string, number, boolean, or null). Per JSON Schema 2020-12 §4.3.2, {}
and true are equivalent. Distinct from an ObjectType with
permissive additionalProperties ({"type":"object"}), which validates
objects only — collapsing the two would reject otherwise-valid
non-object instances.