Description
Extending built-in CDS types such as cds.String, cds.Integer, or cds.Decimal with property annotations using the extend cds.X with (...) syntax has been removed in CDS compiler v7 (CDS 10). This form was used to add annotations or properties to built-in types globally, affecting all elements derived from them. The compiler now emits a hard error for any such extend statement. The replacement approach is to define a named derived type that adds the desired annotations and use that type in element definitions instead of the built-in type directly.
How to Check
- [ ] Run
cds compile— the compiler emits a hard error for eachextend cds.*statement. - [ ] Search all
.cdsfiles for the patternextend cds.to locate all occurrences. - [ ] For each match, verify whether it uses the
with (...)property annotation form versus a plainextendof a user entity (which is valid).
Migration Steps
Identify the
extend cds.*statement and the annotations it adds:cds// Breaking: extending a built-in type extend cds.String with (@UI.Hidden: true);Define a named derived type with the desired annotations:
diff- extend cds.String with (@UI.Hidden: true); + type HiddenString : String @UI.Hidden;Update element definitions that relied on the built-in type to use the derived type instead:
diffentity Documents { key ID : UUID; - internalCode : String; + internalCode : HiddenString; }If the intent was to apply the annotation globally to all
Stringelements, audit all entities and apply the annotation selectively where needed, or use anannotatestatement targeting specific entities.
Notes
The extend cds.* form was a niche feature that had unpredictable effects on the compiled output due to its global scope. The named derived type approach is more explicit and maintainable. Check the CDS documentation for any additional annotation forms that may have been declared via extend cds.* in the project.