Annotations
This section describes the SDL declarations pertaining to annotations.
Examples
Declare a new annotation:
abstract annotation admin_note;
Specify the value of an annotation for a type:
type Status {
annotation admin_note := 'system-critical';
required name: str {
constraint exclusive
}
}
Syntax
Define a new annotation corresponding to the more explicit DDL commands.
Abstract annotation form:
abstract [ inheritable ] annotation name
[ "{" annotation-declarations; [...] "}" ] ;
Concrete annotation (same as annotation-declarations) form:
annotation name := value ;
Description
There are two forms of annotation declarations: abstract and concrete. The abstract annotation form is used for declaring new kinds of annotation in a module. The concrete annotation declarations are used as sub-declarations for all other declarations in order to actually annotate them.
The annotation declaration options are as follows:
- abstract
-
If specified, the annotation will be abstract.
- inheritable
-
If specified, the annotation will be inheritable. The annotations are non-inheritable by default. That is, if a schema item has an annotation defined on it, the descendants of that schema item will not automatically inherit the annotation. Normal inheritance behavior can be turned on by declaring the annotation with the
inheritable
qualifier. This is only valid for abstract annotation. - name
-
The name (optionally module-qualified) of the annotation.
- value
-
Any string value that the specified annotation is intended to have for the given context.
The only valid SDL sub-declarations are concrete annotations:
- annotation-declarations
-
Annotations can also have annotations. Set the annotation of the enclosing annotation to a specific value.