From aabe6f45cb9d78240c6d822b808ce658da17413b Mon Sep 17 00:00:00 2001 From: DJ Adams Date: Tue, 22 Jul 2025 17:18:08 +0100 Subject: [PATCH] Replace 'entity' identifier example from cdl.md In the "Keywords & Identifiers" section there's an example of the keyword `entity` being used as an identifier, which seems confusing and "asking for trouble" :-) Moreover, a little further on, in a "Warning" section, it states "Delimited identifiers in general, but in particular non-ASCII characters, _or keywords as identifiers_ should be avoided as much as possible, for reasons of interoperability." (emphasis mine). In addition, the definition of the `entity` aspect also had an `Integer` key called `ID`, which is perhaps not to be universally encouraged (better to use `cuid` with its `UUID` type). So I reworked this section. --- cds/cdl.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cds/cdl.md b/cds/cdl.md index 4d7770a89..f47fc1eb8 100644 --- a/cds/cdl.md +++ b/cds/cdl.md @@ -41,23 +41,19 @@ The *Conceptual Definition Language (CDL)* is a human-readable language for defi ```cds namespace capire.bookshop; -using { managed } from `@sap/cds/common`; -aspect entity : managed { key ID: Integer } +using { managed, cuid } from `@sap/cds/common`; +aspect primary : managed, cuid {} -entity Books : entity { +entity Books : primary { title : String; author : Association to Authors; } -entity Authors : entity { +entity Authors : primary { name : String; } ``` -::: details Noteworthy... -In the example above `entity` shows up as a keyword, as well as an identifier of an aspect declaration and references to that. -::: - Keywords are *case-insensitive*, but are most commonly used in lowercase notation. Identifiers are *case-significant*, that is, `Foo` and `foo` would identify different things. @@ -69,7 +65,7 @@ type ![Delimited Identifier] : String; ``` ::: warning Avoid using delimited identifiers -Delimited identifiers in general, but in particular non-ASCII characters, or keywords as identifiers should be avoided as much as possible, for reasons of interoperability. +Delimited identifiers in general, but in particular non-ASCII characters, should be avoided as much as possible, for reasons of interoperability. :::