langium-zod / ZodTypeExpression
Type Alias: ZodTypeExpression
ts
type ZodTypeExpression =
| {
kind: "primitive";
primitive: ZodPrimitive;
}
| {
kind: "literal";
value: string;
}
| {
kind: "reference";
typeName: string;
}
| {
element: ZodTypeExpression;
kind: "array";
}
| {
kind: "crossReference";
targetType: string;
}
| {
kind: "union";
members: ZodTypeExpression[];
}
| {
inner: ZodTypeExpression;
kind: "lazy";
};Defined in: types.ts:28
A discriminated union that represents a single Zod type node in the descriptor tree produced by the extractor and consumed by the code generator.
Each variant maps to a specific Zod combinator:
primitive→z.string()/z.number()/z.boolean()/z.bigint()literal→z.literal(value)reference→<TypeName>Schema(a reference to another generated schema)array→z.array(element)crossReference→ReferenceSchema(Langium cross-reference, optionally refined with zRef when cross-reference validation is enabled)union→z.union([...members])lazy→z.lazy(() => inner)(used for self-referential types)
Remarks
This type is part of the lower-level descriptor API. Most consumers do not need to construct ZodTypeExpression values directly; they are produced by the extractor from Langium grammar types. Custom descriptor transformations (e.g. injecting additional validation constraints before code generation) are the primary use case.