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¶
User-defined-types or definition created by the user to express 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. User-defined-types can be declared in any order.
User-defined-types that define fields (entity, key, record, trait, union), optionally support a nested assert declaration allowing object level validation to be performed.
Each type of user-defined type is targeted at a different purpose. Please see details below.
Structural
Behavioural
Metadata
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.