Skip to content

Commit 2e3ca0d

Browse files
Major (May) Release (#1897)
2 parents a447764 + 97c12ae commit 2e3ca0d

92 files changed

Lines changed: 3512 additions & 1836 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/PR-SAP.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: |
1919
git config --global credential.helper "cache --timeout=3600"
2020
echo -e "url=https://user:${GH_TOKEN}@github.com\n" | git credential approve
21-
echo -e "url=https://user:${GH_TOKEN_PARENT}@github.tools.sap\n" | git credential approve
21+
echo -e "url=https://user:${GH_TOKEN_TOOLS_DOCS}@github.tools.sap\n" | git credential approve
2222
git clone --depth 1 --no-single-branch https://github.tools.sap/cap/docs docs
2323
cd docs
2424
git checkout $GITHUB_HEAD_REF || git checkout main
@@ -27,7 +27,7 @@ jobs:
2727
git checkout $GITHUB_HEAD_REF
2828
env:
2929
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30-
GH_TOKEN_PARENT: ${{ secrets.GH_TOKEN_PARENT }}
30+
GH_TOKEN_TOOLS_DOCS: ${{ secrets.GH_TOKEN_TOOLS_DOCS }}
3131
- name: Use Node.js
3232
uses: actions/setup-node@v4
3333
with:
@@ -44,6 +44,7 @@ jobs:
4444
working-directory: docs
4545
env:
4646
NODE_OPTIONS: "--max-old-space-size=6144"
47+
VITE_CAPIRE_CI_HOST: "github.com"
4748
- name: Find broken anchor links
4849
working-directory: docs
4950
run: |

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: |
2020
git config --global credential.helper "cache --timeout=3600"
2121
echo -e "url=https://user:${GH_TOKEN}@github.com\n" | git credential approve
22-
echo -e "url=https://user:${GH_TOKEN_PARENT}@github.tools.sap\n" | git credential approve
22+
echo -e "url=https://user:${GH_TOKEN_TOOLS_DOCS}@github.tools.sap\n" | git credential approve
2323
git clone --depth 1 --no-single-branch https://github.tools.sap/cap/docs docs
2424
cd docs
2525
git checkout $GITHUB_HEAD_REF || git checkout main
@@ -28,7 +28,7 @@ jobs:
2828
git checkout $GITHUB_HEAD_REF
2929
env:
3030
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
GH_TOKEN_PARENT: ${{ secrets.GH_TOKEN_PARENT }}
31+
GH_TOKEN_TOOLS_DOCS: ${{ secrets.GH_TOKEN_TOOLS_DOCS }}
3232
- name: Use Node.js
3333
uses: actions/setup-node@v4
3434
with:

.vitepress/config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const config = defineConfig({
7070

7171
vite: {
7272
build: {
73-
chunkSizeWarningLimit: 5000, // chunk for local search index dominates
73+
chunkSizeWarningLimit: 6000, // chunk for local search index dominates
7474
},
7575
css: {
7676
preprocessorOptions: {
@@ -106,8 +106,8 @@ config.rewrites = rewrites
106106
// Add custom capire info to the theme config
107107
config.themeConfig.capire = {
108108
versions: {
109-
java_services: '3.9.0',
110-
java_cds4j: '3.9.0'
109+
java_services: '3.10.1',
110+
java_cds4j: '3.10.1'
111111
},
112112
gotoLinks: [],
113113
maven_host_base: 'https://repo1.maven.org/maven2'

.vitepress/theme/styles.scss

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ main {
144144

145145
table {
146146
tr, th, td {
147-
// &:nth-child(2n) {
148-
background-color: transparent !important;
149-
// }
147+
background-color: var(--vp-c-bg);
150148
}
151149
td, th {
152150
border-color: #bbb; .dark & { border-color: #555 };
@@ -520,11 +518,6 @@ a.learn-more, p.learn-more, .learn-more {
520518

521519
.VPBadge { white-space: nowrap; }
522520

523-
/* remove transparency in the odd rows (when it scrolls over outline) */
524-
tr:nth-child(odd) {
525-
background-color: var(--vp-c-bg);
526-
}
527-
528521
html.java {
529522
& .node {
530523
display: none;
@@ -550,6 +543,10 @@ html.node {
550543
table:focus {
551544
min-width: fit-content;
552545
}
546+
tr { // make wide rows go over outline, not below it
547+
z-index: 1;
548+
position: relative;
549+
}
553550
[class*='language-'] pre {
554551
overflow: hidden !important;
555552
}

advanced/fiori.md

Lines changed: 33 additions & 57 deletions
Large diffs are not rendered by default.

advanced/hana.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Steps to match the signature of a database object in a facade entity:
5050
* For a view, table function, or calculation view with parameters, check that the parameter names and types match, too.
5151
Functions with table-like input parameters are not supported.
5252

53-
> Note: If a field of that entity is defined as `not null` and you want to disable its runtime check, you can add [`@assert.notNull: false`](../guides/providing-services#assert-notnull). This is important if you want to use, for example [SAP HANA history tables](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/d0b2c5142a19405fb912f71782cd0a84.html).
53+
> Note: If a field of that entity is defined as `not null` and you want to disable its runtime check, you can add `@assert.notNull: false`. This is important if you want to use, for example [SAP HANA history tables](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/d0b2c5142a19405fb912f71782cd0a84.html).
5454
5555

5656
As a result, the database name is defined by the name of the entity or its elements, after applying the SQL name mapping.

advanced/odata.md

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Content-Type: application/json
104104

105105
PATCH requests with delta payload are executed using batch delete and [upsert](../java/working-with-cql/query-api#bulk-upsert) statements, and are more efficient than OData [batch requests](https://docs.oasis-open.org/odata/odata/v4.01/csprd02/part1-protocol/odata-v4.01-csprd02-part1-protocol.html#sec_BatchRequests).
106106

107-
Use PATCH on entity collections for uploading mass data using a dedicated service, which is secured using [role-based authorization](../java/security#role-based-auth). Delta updates must be explicitly enabled by annotating the entity with
107+
Use PATCH on entity collections for uploading mass data using a dedicated service, which is secured using [role-based authorization](../guides/security/authorization#requires). Delta updates must be explicitly enabled by annotating the entity with
108108

109109
```cds
110110
@Capabilities.UpdateRestrictions.DeltaUpdateSupported
@@ -1060,14 +1060,13 @@ If the `groupby` transformation only includes a subset of the entity keys, the r
10601060
| `aggregate` | aggregate values | <X/> | <X/> |
10611061
| `compute` | add computed properties to the result set | <Na/> | <X/> |
10621062
| `expand` | expand navigation properties | <Na/> | <Na/> |
1063-
| `concat` | append additional aggregation to the result | <X/><sup>(1)</sup> | <X/> |
1064-
| `skip` / `top` | paginate | <X/><sup>(1)</sup> | <X/> |
1065-
| `orderby` | sort the input set | <X/><sup>(1)</sup> | <X/> |
1063+
| `concat` | append additional aggregation to the result | <X/> | <X/> |
1064+
| `skip` / `top` | paginate | <X/> | <X/> |
1065+
| `orderby` | sort the input set | <X/> | <X/> |
10661066
| `topcount`/`bottomcount` | retain highest/lowest _n_ values | <Na/> | <Na/> |
10671067
| `toppercent`/`bottompercent` | retain highest/lowest _p_% values | <Na/> | <Na/> |
10681068
| `topsum`/`bottomsum` | retain _n_ values limited by sum | <Na/> | <Na/> |
10691069

1070-
- <sup>(1)</sup> Supported with experimental feature `cds.features.odata_new_parser = true`
10711070

10721071
#### `concat`
10731072

@@ -1139,6 +1138,71 @@ GET SalesOrganizations?$apply=
11391138
/ancestors(..., ID, filter(contains(Name, 'New York')), keep start)
11401139
```
11411140

1141+
#### Modeling Recursive Hierarchies
1142+
1143+
Recursive hierarchies are parent-child hierarchies, where each entity references its parent and through that defines the hierarchical structure. A common example is a company organization structure or HR reporting, where each employee entity references another employee a as direct report or manager.
1144+
1145+
##### Domain Model
1146+
1147+
The simplest domain model looks as follows:
1148+
1149+
```cds
1150+
entity Employee : Hierarchy {
1151+
key ID : UUID;
1152+
parent : Association to Employee;
1153+
fullName : String;
1154+
}
1155+
1156+
aspect Hierarchy {
1157+
virtual LimitedDescendantCount : Integer64;
1158+
virtual DistanceFromRoot : Integer64;
1159+
virtual DrillState : String;
1160+
virtual LimitedRank : Integer64;
1161+
}
1162+
```
1163+
1164+
The entity `Employee` has the element `ID`, which identifies the hierarchy node. The `parent` association references the same entity, which establishes the parent-child relationship.
1165+
1166+
##### Virtual Elements of a Hierarchy
1167+
1168+
The `Hierarchy` aspect defines a set of virtual elements, automatically calculated by the backend at runtime, to describe the state of the hierarchy. This information is requested by the UI to correctly render the hierarchy in a *TreeTable* during user interaction.
1169+
1170+
##### Service Model
1171+
1172+
The following service defines the projection on the domain model.
1173+
1174+
```cds
1175+
service HRService {
1176+
entity HREmployee as projection on Employee;
1177+
}
1178+
```
1179+
1180+
1181+
##### OData v4 Annotations for Fiori
1182+
1183+
To link the backend and Fiori UI, the projected service entity must be enriched with the following annotations.
1184+
1185+
```cds
1186+
annotate HRService.HREmployee with @Aggregation.RecursiveHierarchy #EmployeeHierarchy: {
1187+
$Type: 'Aggregation.RecursiveHierarchyType',
1188+
NodeProperty: ID,
1189+
ParentNavigationProperty: parent
1190+
};
1191+
```
1192+
1193+
Here the `EmployeeHierarchy` specifies a hierarchy qualifier, `NodeProperty` (identifying the hierarchy node) is linked to `ID` of the entity `HREmployee`, and the `ParentNavigationProperty` is linked to a corresponding `parent` association.
1194+
1195+
```cds
1196+
annotate HRService.HREmployee with @Hierarchy.RecursiveHierarchy #EmployeeHierarchy: {
1197+
$Type: 'Hierarchy.RecursiveHierarchyType',
1198+
LimitedDescendantCount: LimitedDescendantCount,
1199+
DistanceFromRoot: DistanceFromRoot,
1200+
DrillState: DrillState,
1201+
LimitedRank: LimitedRank
1202+
};
1203+
```
1204+
1205+
Here the same qualifier `EmployeeHierarchy` is referenced to list the names of the [virtual elements of the hierarchy](#virtual-elements-of-a-hierarchy).
11421206

11431207
### Aggregation Methods
11441208

advanced/publishing-apis/asyncapi.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,39 @@ service CatalogService {
110110
}
111111
```
112112

113+
## Extensions { #extensions}
114+
115+
`@AsyncAPI.Extensions` can be used to provide arbitrary extensions.
116+
If a specific annotation exists for a given extension, it takes precedence over the definition using @AsyncAPI.Extensions.
117+
For example, if both `@AsyncAPI.ShortText` and `@AsyncAPI.Extensions: { ![sap-shortText]: 'baz' }` are provided, the value from `@AsyncAPI.ShortText` will override the one defined in @AsyncAPI.Extensions.
118+
119+
For example:
120+
121+
```cds
122+
@AsyncAPI.Extensions : {
123+
![foo-bar] : 'baz',
124+
![sap-shortText] : 'Service Base 1'
125+
}
126+
127+
service CatalogService {
128+
@AsyncAPI.Extensions : {
129+
![sap-event-source] : '/{region}/sap.app.test'
130+
}
131+
event SampleEntity.Changed.v1 : projection on CatalogService.SampleEntity;
132+
}
133+
```
134+
135+
The `@AsyncAPI.Extensions` annotation can be applied at both the service level and the event level.
136+
137+
Since the AsyncAPI specification requires all extensions to be prefixed with `x-`, the compiler will automatically add this prefix. Therefore, do not include the `x-` prefix when specifying extensions in `@AsyncAPI.Extensions`.
138+
139+
### Behavior with `--merged` flag
140+
141+
When the `--merged` CLI flag is used:
142+
143+
- Extensions defined via `@AsyncAPI.Extensions` on `services` are **ignored**.
144+
- Extensions defined via `@AsyncAPI.Extensions` on `events` remain effective and are applied as expected.
145+
113146
## Type Mapping { #mapping}
114147

115148
CDS Type to AsyncAPI Mapping
@@ -120,15 +153,15 @@ CDS Type to AsyncAPI Mapping
120153
| `Boolean` | `{ "type": "boolean" }` |
121154
| `Integer` | `{ "type": "integer" }` |
122155
| `Integer64` | `{ "type": "string", "format": "int64" }` |
123-
| `Decimal`, `{precision, scale}` | `{ "type": "string", "format": "decimal", "formatPrecision": <precision>, "formatScale": <scale> }` |
124-
| `Decimal`, without scale | `{ "type": "string", "format": "decimal", "formatPrecision": <precision> }` |
156+
| `Decimal`, `{precision, scale}` | `{ "type": "string", "format": "decimal", "x-sap-precision": <precision>, "x-sap-scale": <scale> }` |
157+
| `Decimal`, without scale | `{ "type": "string", "format": "decimal", "x-sap-precision": <precision> }` |
125158
| `Decimal`, without precision and scale | `{ "type": "string", "format": "decimal" }` |
126159
| `Double` | `{ "type": "number" }` |
127160
| `Date` | `{ "type": "string", "format": "date" }` |
128161
| `Time` | `{ "type": "string", "format": "partial-time" }` |
129162
| `DateTime` | `{ "type": "string", "format": "date-time" }` |
130163
| `Timestamp` | `{ "type": "string", "format": "date-time" }` |
131-
| `String` | `{ "type": "string", "maxLength": length }` |
132-
| `Binary` | `{ "type": "string", "maxLength": length }` |
164+
| `String`, `{maxLength}` | `{ "type": "string", "maxLength": length }` |
165+
| `Binary`, `{maxLength}` | `{ "type": "string", "maxLength": length }` |
133166
| `LargeBinary` | `{ "type": "string" }` |
134167
| `LargeString` | `{ "type": "string" }` |

cds/annotations.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/
2828

2929
| Annotation | Description |
3030
|---------------|------------------------------------------------------------------|
31-
| `@readonly` | see [Input Validation](../guides/providing-services#readonly) |
32-
| `@insertonly` | see [Generic Handlers](../guides/providing-services) |
3331
| `@restrict` | see [Authorization](../guides/security/authorization#restrict-annotation) |
3432
| `@requires` | see [Authorization](../guides/security/authorization#requires) |
3533

@@ -40,12 +38,9 @@ uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/
4038
|---------------------|----------------------------------------------------------------------|
4139
| `@readonly ` | see [Input Validation](../guides/providing-services#readonly) |
4240
| `@mandatory` | see [Input Validation](../guides/providing-services#mandatory) |
43-
| `@assert.unique` | see [Input Validation](../guides/providing-services#assert-unique) |
44-
| `@assert.integrity` | see [Input Validation](../guides/databases#database-constraints) |
4541
| `@assert.target` | see [Input Validation](../guides/providing-services#assert-target) |
4642
| `@assert.format` | see [Input Validation](../guides/providing-services#assert-format) |
4743
| `@assert.range` | see [Input Validation](../guides/providing-services#assert-range) |
48-
| `@assert.notNull` | see [Input Validation](../guides/providing-services#assert-notnull) |
4944

5045

5146

@@ -102,4 +97,3 @@ Intrinsically supported OData Annotations:
10297
| `@Core.IsMediaType` | see [Media Data](../guides/providing-services#serving-media-data) |
10398
| `@Core.IsUrl` | see [Media Data](../guides/providing-services#serving-media-data) |
10499
| `@Capabilities...` | see [Fiori](../advanced/fiori) |
105-
| `@Common.FieldControl` | see [Input Validation](../guides/providing-services#common-fieldcontrol) |

cds/cdl.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -302,20 +302,9 @@ entity Employees {
302302
```
303303

304304
The text of a doc comment is stored in CSN in the property `doc`.
305-
When generating OData EDM(X), it appears as value for the annotation `@Core.Description`.
306-
307-
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):
308-
309-
```sql
310-
CREATE TABLE Employees (
311-
ID INTEGER,
312-
name NVARCHAR(...) COMMENT 'I am the description for "name"'
313-
) COMMENT 'I am the description for "Employee"'
314-
```
315-
316-
::: tip
317-
Propagation of doc comments can be stopped via an empty one: `/** */`.
318-
:::
305+
Doc comments are not propagated. For example, a doc comment defined for an entity
306+
isn't automatically copied to projections of this entity.
307+
When generating OData EDM(X), doc comments are translated to the annotation `@Core.Description`.
319308

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

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

332321
:::
333322

334-
::: tip Doc comments are enabled by default in CAP Java.
335-
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).
323+
::: tip Doc comments are automatically enabled in CAP Java.
324+
In CAP Java, doc comments are automatically enabled by the [CDS Maven Plugin](../java/developing-applications/building#cds-maven-plugin).
325+
In generated interfaces they are [converted to corresponding Javadoc comments](../java/assets/cds-maven-plugin-site/generate-mojo.html#documentation).
336326
:::
337327

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

339-
340-
331+
```sql
332+
CREATE TABLE Employees (
333+
ID INTEGER,
334+
name NVARCHAR(...) COMMENT 'I am the description for "name"'
335+
) COMMENT 'I am the description for "Employee"'
336+
```
341337

342338

343339
## Entities & Type Definitions
@@ -808,6 +804,21 @@ By using a cast, annotations and other properties are inherited from the provide
808804

809805
<div id="afterinferredsig" />
810806

807+
### Virtual elements in views
808+
809+
Virtual elements can be defined in views or projections like this:
810+
```cds
811+
entity SomeView as select from Employee {
812+
// ...,
813+
virtual virt1 : String(22),
814+
virtual virt2 // virtual element without type
815+
}
816+
```
817+
These virtual elements have no relation to the query source `Employee` but are new fields
818+
in the view. Virtual elements in views or projections are handled as described in the
819+
section on [virtual elements in entities](#virtual-elements).
820+
821+
811822
<div id="beforeviewwithparam" />
812823

813824
### Views with Parameters

0 commit comments

Comments
 (0)