Skip to manual
gluon

GOL language

StructType

A StructType groups typed fields into one value, such as Money, with no identity of its own.

Model author or developer

Where it goes

Contoso keeps Money in domains/core/types.yaml. The loader reads every YAML file under the package root, so folders are a convention you can change. Name it in PascalCase. The name must be unique within its domain across all type kinds.

Fields

The keys under spec. Nested shapes follow StructTypeSpec in the GOL JSON Schema.

FieldPresenceShape
fieldsRequiredpropertyMap
invariantsOptionalinvariants
displayOptionalobject

Syntax and rules

The examples are fragments. Put them in a package next to the resources they reference. A ... stands for a CEL expression you write yourself.

4.3 StructType (value object, composite)

GOL · YAML
kind: StructType
metadata: { name: Money }
spec:
  fields:
    amount: { type: "decimal(18,2)", required: true }
    currency: { type: "std::CurrencyCode", required: true }
  invariants:
    - { id: non-negative, expr: self.amount >= 0.0, message: Amount cannot be negative }
  display: { format: "{currency} {amount}" }

Structs have no identity, cannot be link ends and cannot nest deeper than defaults.maxStructDepth (3).

Check your package

Shell
gluon validate examples/contoso
gluon test examples/contoso

validate reports each problem with a GLN code and its place in the file. test runs the package's Test resources. See the language guide and the diagnostics.

Contoso's Money StructType in the designer's YAML pane, with its validation status.
Contoso's Money StructType in the designer's YAML pane, with its validation status.