Type System

Top level constructs

These optional constructs can be used to organise your definitions better, reuse declarations, and define reusable fields types.

User-defined types

These are the user-defined-types ( UDTs ) used to define the data model. UDTs can be nested within namespace declarations or be top-level declarations themselves by having namespace prefixed as part of the declaration. UDTs can be declared in any order.

UDTs that define fields (entity, key, record, trait, union), optionally support a nested assertAll declaration allowing object level validation to be performed.

Structural

Behavioural

Scalar types

ALFA supports a wide range of primitive scalar types. Some of these will not translate directly a primitive type in target languages. However ALFA runtime libraries will encapsulate the required validation required.

Where applicable, scalar types accept optional size constraints to be enforced by the runtime code. This can further improve data quality. Refer to individual types for further details.

Vector and composite types

All ALFA parameterized types can nested, unless otherwise stated. e.g. map< string, list< int ? > > or map< string, map< int, string > > are valid declarations.

Vector types accept optional size constraints to be enforced by the runtime code. This can be used to safeguard against under or over supply of values. Refer to individual types for further details.