Skip to content

langium-zod / PropertyLike

Interface: PropertyLike

Defined in: types.ts:192

Duck-typed representation of a single property within a Langium InterfaceType.

Captures the grammar-level attributes the extractor uses to determine the Zod type expression, optionality, and array cardinality for a property:

  • operator / assignment — grammar assignment operators (=, +=, ?=).
  • cardinality — cardinality suffix on the property's type node.
  • ruleCall.cardinality — cardinality on the rule call inside the type node (Langium 4.x shape).
  • isCrossRef / referenceType — signals that the property holds a Langium cross-reference rather than an inline value.

Properties

PropertyTypeDescriptionDefined in
assignment?"=" | "+=" | "?="Alternative assignment field used in some Langium 3.x AST shapes; the extractor consults both operator and assignment.types.ts:208
cardinality?"*" | "+" | "?"Cardinality suffix on the property's type node (*, +, ?).types.ts:210
comment?stringJSDoc/grammar comment for this property, propagated to form metadata.types.ts:224
isCrossRef?booleantrue when the property holds a Langium cross-reference (ref: prefix).types.ts:217
namestringProperty name as declared in the grammar (e.g. "left", "elements").types.ts:194
operator?"=" | "+=" | "?="Grammar assignment operator: = (single value), += (array append), ?= (boolean flag).types.ts:203
optional?booleantrue when the grammar marks the property optional.types.ts:198
referenceType?stringTarget type name for cross-reference properties (e.g. "Symbol" in ref:Symbol). Used by the extractor to emit ReferenceSchema with the correct target type name.types.ts:222
ruleCall?{ cardinality?: "*" | "+" | "?"; }Cardinality on the rule call inside the type node (Langium 4.x shape); the extractor checks this when cardinality is absent.types.ts:215
ruleCall.cardinality?"*" | "+" | "?"-types.ts:215
type?unknownRaw Langium type node for this property, inspected by the type mapper.types.ts:196

Released under the MIT License.