Skip to content

(cds 9) Propagation of doc comments #1825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions cds/cdl.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,20 +302,9 @@ entity Employees {
```

The text of a doc comment is stored in CSN in the property `doc`.
When generating OData EDM(X), it appears as value for the annotation `@Core.Description`.

When generating output for deployment to SAP HANA, the first paragraph of a doc comment is translated to the HANA `COMMENT` feature for tables, table columns, and for views (but not for view columns):

```sql
CREATE TABLE Employees (
ID INTEGER,
name NVARCHAR(...) COMMENT 'I am the description for "name"'
) COMMENT 'I am the description for "Employee"'
```

::: tip
Propagation of doc comments can be stopped via an empty one: `/** */`.
:::
Doc comments are not propagated. For example, a doc comment defined for an entity
isn't automatically copied to projections of this entity.
When generating OData EDM(X), doc comments are translated to the annotation `@Core.Description`.

In CAP Node.js, doc comments need to be switched on when calling the compiler:

Expand All @@ -331,13 +320,20 @@ cds.compile(..., { docs: true })

:::

::: tip Doc comments are enabled by default in CAP Java.
In CAP Java, doc comments are automatically enabled by the [CDS Maven Plugin](../java/developing-applications/building#cds-maven-plugin). In generated interfaces they are [converted to corresponding Javadoc comments](../java/assets/cds-maven-plugin-site/generate-mojo.html#documentation).
::: tip Doc comments are automatically enabled in CAP Java.
In CAP Java, doc comments are automatically enabled by the [CDS Maven Plugin](../java/developing-applications/building#cds-maven-plugin).
In generated interfaces they are [converted to corresponding Javadoc comments](../java/assets/cds-maven-plugin-site/generate-mojo.html#documentation).
:::

When generating output for deployment to SAP HANA, the first paragraph of a doc comment is translated
to the HANA `COMMENT` feature for tables, table columns, and for views (but not for view columns):



```sql
CREATE TABLE Employees (
ID INTEGER,
name NVARCHAR(...) COMMENT 'I am the description for "name"'
) COMMENT 'I am the description for "Employee"'
```


## Entities & Type Definitions
Expand Down
Loading