Annotations
Annotations are named values associated with schema items and are designed to hold arbitrary schema-level metadata represented as a str.
Standard annotations
There is a number of annotations defined in the standard library. The following are the annotations which can be set on any schema item:
titledescriptiondeprecated
For example, consider the following declaration:
1. type Status {
2. annotation title := 'Activity status';
3. annotation description := 'All possible user activities';
5. required property name -> str {
6. constraint exclusive
7. }
8. }
The deprecated annotation is used to mark deprecated items (e.g. str_rpad()) and to provide some information such as what should be used instead.
User-defined annotations
To declare a custom constraint type beyond the three built-ins, add an abstract annotation type to your schema. A custom annotation could be used to attach arbitrary JSON-encoded data to your schema—potentially useful for introspection and code generation.
1. abstract annotation admin_note;
3. type Status {
4. annotation admin_note := 'system-critical';
5. }
︙
| See also |
| SDL > Annotations |
| DDL > Annotations |
| Cheatsheets > Annotations |
| Introspection > Object types |
