Annotations¶
Annotation allow metadata to be declared and used in data model constructs. These are extremely useful for tooling and applications to
Annotations are named and applicable target constructs (record, entity, enum, trait, service, library, union, key, udt, field, keyfield) are defined as part of the declaration along with attributes.
annotation PII ( record, entity, field ) {
Sensitivity : SensitivityLevelType
}
enum SensitivityLevelType { Low, Medium, High }
Given the defintion above, it is possible to annotate records, entities or fields with PII
. As the field Sensitivity
is mandatory it needs to be specified, otherwise an error will be reported.
@PII( SensitivityLevelType.Low )
record Employee {
Name : string
@PII(SensitivityLevelType.High)
Salary : double
}