Description
In CDS 9 and earlier, texts entities were accessible by their compound name as a key in cds.model.definitions, for example cds.model.definitions['Books.texts']. CDS 10 changes this so that the texts entity is accessed as a property on the parent entity: cds.model.definitions['Books'].texts. Code using the old bracket-notation form will no longer find the entity — definitions['Books.texts'] returns undefined. The features.compat_texts_entities flag restores the old lookup temporarily, but it will be removed in a future release.
How to Check
- [ ] Search source files for bracket access on a
.definitionsobject where the key string ends in.texts(e.g.definitions['Books.texts'],definitions["Foo.texts"]). - [ ] Check
cds envoutput forcds.features.compat_texts_entitiesto see whether the compat flag is already active. - [ ] Review any reflection utilities or helper modules that iterate
cds.model.definitionsand filter by name suffix.
Migration Steps
- Identify all occurrences of bracket access on
.definitionswith a.textskey:
-const BooksTexts = cds.model.definitions['Books.texts'];
+const BooksTexts = cds.model.definitions['Books'].texts;- Update any programmatic construction of the compound key string:
-const textsEntity = model.definitions[entityName + '.texts'];
+const textsEntity = model.definitions[entityName]?.texts;If the codebase is large, temporarily set the compat flag to restore the CDS 9 lookup behavior while migrating. This flag is a temporary migration aid and will be removed in a future release:
diff// package.json or .cdsrc.json { "cds": { "features": { + "compat_texts_entities": true } } }Remove the flag once all usages have been updated to use the property-chain form (
definitions['Books'].texts).
Examples
Old access pattern — breaking in CDS 10 without compat flag:
// Breaking: compound key access in definitions
const BookTexts = cds.model.definitions['Books.texts'];
const fields = Object.keys(BookTexts.elements);New access pattern — correct in CDS 10:
// Correct: property chain
const BookTexts = cds.model.definitions['Books'].texts;
const fields = Object.keys(BookTexts.elements);The same applies when looking up texts entities dynamically:
// Old
const entity = cds.model.definitions[`${entityName}.texts`];
// New
const entity = cds.model.definitions[entityName]?.texts;