Description
In CDL, the ellipsis (...) inside an annotation array value is used to merge with an existing annotation array on the annotated element. In CDS compiler v7 (CDS 10), using [..., ...] in an annotate statement when no base annotation exists on the target is a hard error. Previously this was a configurable warning (anno-unexpected-ellipsis). Any CDL annotate block that spreads into a non-existent base array annotation will fail to compile. The fix is either to remove the ellipsis (if no merge is needed) or to ensure the base annotation is defined before annotating.
How to Check
- [ ] Run
cds compile— the compiler will emit an error for each occurrence. - [ ] Search all
.cdsfiles for the pattern[...to locate annotation array merge expressions. - [ ] For each match, verify whether the target element already has the annotation being extended; if not, the ellipsis is invalid.
Migration Steps
Identify the
annotateblock containing the invalid ellipsis:cds// Before: ellipsis used but no base @UI.LineItem annotation exists annotate Books with @UI.LineItem : [..., { Value: stock } ];If no base annotation exists and no merge is intended, remove the ellipsis:
diff- annotate Books with @UI.LineItem : [..., - { Value: stock } - ]; + annotate Books with @UI.LineItem : [ + { Value: stock } + ];If merging with an existing base annotation from another file or the entity definition is the intent, ensure the base annotation is defined before the
annotatestatement:diff+ @UI.LineItem: [] entity Books { ... } annotate Books with @UI.LineItem : [..., { Value: stock } ];
Examples
Ellipsis where the base annotation does not yet exist — breaking:
// Breaking: @MyAnno has never been applied to Books;
// extending it with [...] before the base exists is an error
annotate Books with @MyAnno: [...];Ellipsis extending an annotation that already exists — not breaking (valid CDL):
// Not breaking: @UI.LineItem already exists on Books
annotate Books with @UI.LineItem: [..., {
Value: title
}];Notes
The anno-unexpected-ellipsis message code was configurable as a warning in CDS compiler v6. Projects that suppressed the warning via --messageLevel or cds.compiler.messages config will now encounter a hard error. Check compiler configuration for any message-level overrides for anno-unexpected-ellipsis and remove them alongside fixing the CDL.