Skip to content
Closed
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions .vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
const base = process.env.GH_BASE || '/docs/'

// Construct vitepress config object...
import { dirname, join, resolve } from 'node:path'
import { readFileSync } from 'node:fs'
import { dirname, join, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitepress'
import playground from './lib/cds-playground/index.js'
import languages from './languages'
import playground from './lib/cds-playground/index.js'
import { Menu } from './menu.js'

const __dirname = dirname(fileURLToPath(import.meta.url))
Expand Down Expand Up @@ -44,6 +44,13 @@ const config = defineConfig({
toc: {
level: [2,3]
},
anchor: {
// VS Code-compatible GitHub-style slugifier (mirrors markdown-language-features/src/slugify.ts)
slugify: (str) => str
.trim().toLowerCase()
.replace(/[^\p{L}\p{N}\p{M}\s_-]/gu, '')
.replace(/\s/g, '-'),
},
container: { // Doesn't seem to work yet
infoLabel: 'Info',
noteLabel: 'Note',
Expand Down Expand Up @@ -203,10 +210,10 @@ config.themeConfig.search = {

// Add custom markdown renderers...
import { dl } from '@mdit/plugin-dl'
import * as MdAttrsPropagate from './lib/md-attrs-propagate'
import * as MdTypedModels from './lib/md-typed-models'
import * as MdLiveCode from './lib/cds-playground/md-live-code'
import * as MdAttrsPropagate from './lib/md-attrs-propagate'
import * as MdDiagramSvg from './lib/md-diagram-svg'
import * as MdTypedModels from './lib/md-typed-models'

config.markdown.config = md => {
MdAttrsPropagate.install(md)
Expand Down
6 changes: 3 additions & 3 deletions cds/_menu.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

# [Definition Language (CDL)](cdl)

## [Keywords & Identifiers](cdl#keywords-identifiers)
## [Keywords & Identifiers](cdl#keywords--identifiers)
## [Built-in Types & Literals](cdl#built-in-types)
## [Entities & Type Definitions](cdl#entities-type-definitions)
## [Views & Projections](cdl#views-projections)
## [Entities & Type Definitions](cdl#entities--type-definitions)
## [Views & Projections](cdl#views--projections)
## [Associations](cdl#associations)
## [Annotations](cdl#annotations)
## [Aspects](cdl#aspects)
Expand Down
18 changes: 9 additions & 9 deletions cds/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/
|------------------|----------------------------------------------------------------------|
| `@readonly ` | see [Input Validation](../guides/services/constraints#readonly) |
| `@mandatory` | see [Input Validation](../guides/services/constraints#mandatory) |
| `@assert.target` | see [Input Validation](../guides/services/constraints#assert-target) |
| `@assert.format` | see [Input Validation](../guides/services/constraints#assert-format) |
| `@assert.range` | see [Input Validation](../guides/services/constraints#assert-range) |
| `@assert.target` | see [Input Validation](../guides/services/constraints#asserttarget) |
| `@assert.format` | see [Input Validation](../guides/services/constraints#assertformat) |
| `@assert.range` | see [Input Validation](../guides/services/constraints#assertrange) |



Expand All @@ -56,21 +56,21 @@ uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/
| `@cds.api.ignore` | see [OData](../guides/protocols/odata#omitting-elements-from-apis) |
| `@cds.query.limit` | see [Providing Services](../guides/services/served-ootb#annotation-cds-query-limit) |
| `@cds.localized` | see [Localized Data](../guides/uis/localized-data#read-operations) |
| `@cds.valid.from/to` | see [Temporal Data](../guides/domain/temporal-data#using-annotations-cds-valid-from-to) |
| `@cds.valid.from/to` | see [Temporal Data](../guides/domain/temporal-data#using-annotations-cdsvalidfromto) |
| `@cds.search` | see [Search Capabilities](../guides/services/served-ootb#searching-data) |

## Persistence

| Annotation | Description |
|---------------------------|------------------------------------------------------------------------------|
| `@cds.persistence.exists` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#cds-persistence-exists) |
| `@cds.persistence.table` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#cds-persistence-table) |
| `@cds.persistence.skip` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#cds-persistence-skip) |
| `@cds.persistence.exists` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#cdspersistenceexists) |
| `@cds.persistence.table` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#cdspersistencetable) |
| `@cds.persistence.skip` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#cdspersistenceskip) |
| `@cds.persistence.mock` | `false` excludes this entity from automatic mocking |
| `@cds.on.insert` | see [Providing Services](../guides/services/providing-services) |
| `@cds.on.update` | see [Providing Services](../guides/services/providing-services) |
| `@sql.prepend` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#sql-prepend-append) |
| `@sql.append` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#sql-prepend-append) |
| `@sql.prepend` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#sqlprepend--append) |
| `@sql.append` | see [Generating DDL Files](../guides/databases/cdl-to-ddl#sqlprepend--append) |

## OData

Expand Down
6 changes: 3 additions & 3 deletions cds/cdl.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The *Conceptual Definition Language (CDL)* is a human-readable language for defi



- [Keywords & Identifiers](#keywords-identifiers)
- [Keywords & Identifiers](#keywords--identifiers)
- [Built-in Types](#built-in-types)
- [Literals](#literals)
- [Model Imports](#model-imports)
Expand Down Expand Up @@ -696,7 +696,7 @@ entity Orders {
}
```

To enforce your _enum_ values during runtime, use the [`@assert.range` annotation](../guides/services/constraints#assert-range).
To enforce your _enum_ values during runtime, use the [`@assert.range` annotation](../guides/services/constraints#assertrange).
For localization of enum values, model them as [code list](./common#adding-own-code-lists).

<br>
Expand Down Expand Up @@ -858,7 +858,7 @@ Result result = service.run(Select.from("UsingView"), params);

### Runtime Views { #runtimeviews }

To add or update CDS views without redeploying the database schema, annotate them with [@cds.persistence.skip](../guides/databases/cdl-to-ddl#cds-persistence-skip). This advises the CDS compiler to skip generating database views for these CDS views. Instead, CAP resolves them *at runtime* on each request.
To add or update CDS views without redeploying the database schema, annotate them with [@cds.persistence.skip](../guides/databases/cdl-to-ddl#cdspersistenceskip). This advises the CDS compiler to skip generating database views for these CDS views. Instead, CAP resolves them *at runtime* on each request.

Runtime views must be simple [projections](#as-projection-on), not using *aggregations*, *join*, *union* or *subqueries* in the *from* clause, but may have a *where* condition if they are only used to read.

Expand Down
2 changes: 1 addition & 1 deletion cds/compiler/hdbcds-to-hdbtable.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ If the table doesn't contain much data, this process won't significantly impact

## Annotations

Annotations [`@sql.append/prepend`](../../guides/databases/cdl-to-ddl#sql-prepend-append) are used to generate native SQL clauses to the _.hdbtable_ files, or add native SAP HANA CDS clauses to the _.hdbcds_ files.
Annotations [`@sql.append/prepend`](../../guides/databases/cdl-to-ddl#sqlprepend--append) are used to generate native SQL clauses to the _.hdbtable_ files, or add native SAP HANA CDS clauses to the _.hdbcds_ files.

If you have used these annotations in your model, a simple switchover from `hdbcds` to `hdbtable` is unlikely as such an annotation written for `hdbcds` in general is not valid for `hdbtable`. You'll have to adapt your model before the migration.

Expand Down
2 changes: 1 addition & 1 deletion cds/cqn.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ let results = await cds.run (query)
```

Following is a detailed specification of the CQN as [TypeScript declarations](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), including all query types and their properties,
as well as the fundamental expression types. Find the [full CQN type definitions in the appendix below](#full-cqn-d-ts-file).
as well as the fundamental expression types. Find the [full CQN type definitions in the appendix below](#full-cqndts-file).


## SELECT
Expand Down
6 changes: 3 additions & 3 deletions cds/cxl.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ This syntax diagram describes the possible expressions:

### In Queries

Expressions can be used in various parts of a query, e.g., on the select list, in the where clause, in order by clauses, and more:
Expressions can be used in various parts of a query, for example,, on the select list, in the where clause, in order by clauses, and more:

```cds live
SELECT from Books {
Expand Down Expand Up @@ -576,10 +576,10 @@ Following table gives an overview of the guaranteed supported operators in CXL:
| `and`, `or` | Logical operators. | `x>1 or y<2` |

> [!tip] Bivalent `==` and `!=` Operators
> In addition to standard SQL's `=` and `<>` operators, CXL also supports `==` and `!=` as bivalent variants as opposed to the trivalent semantics of `=` and `<>` when it comes to null handling. Learn more about this in the [_Bivalent `==` and `!=` Operators_](../guides/databases/cap-level-dbs#bivalent-and-operators) section of the databases documentation.
> In addition to standard SQL's `=` and `<>` operators, CXL also supports `==` and `!=` as bivalent variants as opposed to the trivalent semantics of `=` and `<>` when it comes to null handling. Learn more about this in the [_Bivalent `==` and `!=` Operators_](../guides/databases/cap-level-dbs#bivalent--and--operators) section of the databases documentation.

> [!tip] Ternary `?:` Operator
> In addition to the standard SQL `case when then` expression, CXL also supports the ternary `?:` operator as a more concise syntax for simple case expressions. Learn more about this in the [_Ternary `?:` Operator_](../guides/databases/cap-level-dbs#ternary-operator) section of the databases documentation.
> In addition to the standard SQL `case when then` expression, CXL also supports the ternary `?:` operator as a more concise syntax for simple case expressions. Learn more about this in the [_Ternary `?:` Operator_](../guides/databases/cap-level-dbs#ternary--operator) section of the databases documentation.



Expand Down
2 changes: 1 addition & 1 deletion cds/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For example, a *data model describes the type structure (commonly also called *'

### Representations

Models can come in different *representations*, which follow different *syntaxes*. For example, we use the *CDL* syntax for *human-readable* representations of CDS models, while CSN is an *object notation*, i.e. a special form of *syntax*, used for *machine-readable* representations of CDS models.
Models can come in different *representations*, which follow different *syntaxes*. For example, we use the *CDL* syntax for *human-readable* representations of CDS models, while CSN is an *object notation*, that is a special form of *syntax*, used for *machine-readable* representations of CDS models.

::: details On CSN representations...

Expand Down
4 changes: 2 additions & 2 deletions cds/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ANSI SQL types, when deployed to a relational database (concrete mappings to spe
| `UInt8` | Unsigned 8-bit integer, range *[ 0 ... 255 ]* | _TINYINT_ |
| `Decimal`(`p`,`s`) | Decimal with precision `p` and scale `s` | _DECIMAL_ |
| `Double` | Floating point with binary mantissa | _DOUBLE_ |
| `Date` | e.g. `2022-12-31` | _DATE_ |
| `Time` | e.g. `23:59:59` | _TIME_ |
| `Date` | for example, `2022-12-31` | _DATE_ |
| `Time` | for example, `23:59:59` | _TIME_ |
| `DateTime` | _sec_ precision | _TIMESTAMP_ |
| `Timestamp` | _µs_ precision, with up to 7 fractional digits | _TIMESTAMP_ |
| `String` (`length`) | Default *length*: 255; on HANA: 5000 | _NVARCHAR_ |
Expand Down
6 changes: 3 additions & 3 deletions get-started/bookshop.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ entity Genres : sap.common.CodeList {

###### Focus on Domain
> [!tip] Primary Focus on Domain
> Strive to keep your domain models simple, concise and comprehensible, focused on the core concepts of your domain, i.e., [_“Keep it simple, stupid!”_](https://en.wikipedia.org/wiki/kiss_principle). Factor out secondary concerns into separate sources, which _extend_ and _annotate_ the core models.\
> Strive to keep your domain models simple, concise and comprehensible, focused on the core concepts of your domain, that is, [_“Keep it simple, stupid!”_](https://en.wikipedia.org/wiki/kiss_principle). Factor out secondary concerns into separate sources, which _extend_ and _annotate_ the core models.\
> See also: [_Separation of Concerns_](#separation-of-concerns).

[Learn more about _Domain Modeling_.](../guides/domain/index){ .learn-more}
Expand Down Expand Up @@ -597,7 +597,7 @@ We can also send such OData requests programmatically, for example, doing the ve
await cds.service.bindings
```
::: details About _cds.service.bindings_ ...
The `cds.service.bindings` command fetches the service bindings from a running CAP server instance in another process, and makes them available in the current process, e.g., within `cds repl`.
The `cds.service.bindings` command fetches the service bindings from a running CAP server instance in another process, and makes them available in the current process, for example, within `cds repl`.
```js
[cds] - using bindings from: { registry: '~/.cds-services.json' }
Bindings {
Expand Down Expand Up @@ -686,7 +686,7 @@ While the generic providers serve most CRUD requests out of the box, you can add

- Use [declarative constraints](#declarative-constraints) for most input validation cases, which are enforced by generic runtimes automatically.

- Add [custom event handlers in Node.js](#custom-handlers-in-node-js) or [in Java](#custom-handlers-in-java) to CAP services for more complex programmatic logic, such as modifying response data, or handling [custom actions](#custom-actions).
- Add [custom event handlers in Node.js](#custom-handlers-in-nodejs) or [in Java](#custom-handlers-in-java) to CAP services for more complex programmatic logic, such as modifying response data, or handling [custom actions](#custom-actions).

> [!note] Choosing between Node.js and Java
> The latter is the first time in this guide where you need to choose between Node.js and Java as your CAP runtime.
Expand Down
17 changes: 10 additions & 7 deletions get-started/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The major building blocks are as follows:

- [**Core Data Services** (CDS)](../cds/) — CAP's universal modeling language, and the very backbone of everything; used to capture domain knowledge, generating database schemas, translating to and from various API languages, and most important: fueling generic runtimes to automatically serve request out of the box.

- [**Service Runtimes**](../guides/services/providing-services) for [Node.js](../node.js/) and [Java](../java/) — providing the core frameworks for services, generic providers to serve requests automatically, database support for SAP HANA, SQLite, and PostgreSQL, and protocol adaptors for REST, OData, GraphQL, ...
- [**Service Runtimes**](../guides/services/providing-services) for [Node.js](../node.js/) and [Java](../java/) — providing the core frameworks for services, generic providers to serve requests automatically, database support for SAP HANA, SQLite, and PostgreSQL, and protocol adapters for REST, OData, GraphQL, ...

- [**Platform Integrations**](../plugins/) — providing CAP-level service interfaces (*'[Calesi](#the-calesi-pattern)'*) to cloud platform services in platform-agnostic ways, as much as possible. Some of these are provided out of the box, others as plugins.

Expand Down Expand Up @@ -150,7 +150,7 @@ INNER JOIN Countries as country ON country.code = author.country_code
-- the actual filter condition:
WHERE country.code = 'GB';
```
Path expressions in *infix filters* become *SEMI JOINs*, e.g.using `IN`:
Path expressions in *infix filters* become *SEMI JOINs*, for example, using `IN`:
```sql
CREATE VIEW EnglishBooks AS SELECT * FROM Books
-- for Association Books:author:
Expand Down Expand Up @@ -702,16 +702,19 @@ Your application models are your services, also served automatically by generic

### Protocol Adapters

Behind the scenes, i.e., in the **outer hexagon** containing stuff, you as an application developer should not see, the CAP runtime employs Protocol Adapters, which translate requests from (and to) low-level protocols like HTTP, REST, OData, GraphQL, ... to protocol-agnostic CAP requests and queries.
Behind the scene - that is, in the **outer hexagon** containing stuff, you as an application developer should not see - the CAP runtime employs Protocol Adapters, which translate requests from (and to) low-level protocols like HTTP, REST, OData, GraphQL, ... to protocol-agnostic CAP requests and queries for inbound and outbound communication.

- for ***inbound*** communication → i.e., requests your application *receives*, as well as as...
- for ***outbound*** communication → i.e., requests your application *sends* to other services.
--> ***Inbound*** Communication
: Requests your application *receives*.

In effect your service implementations stay agnostic to (wire) protocols, which allows us to exchange protocols, replace targets by mocks, do fast inner loop development in airplane mode, ... even change topologies from a monolith to micro services and vice versa late in time.
--> ***Outbound*** Communication
: Requests your application *sends* to other services.

In effect your service implementations stay agnostic to (wire) protocols, which allows you to exchange protocols, replace targets by mocks, do fast inner loop development in airplane mode, ... even change topologies from a monolith to micro services and vice versa late in time.

![protocol-adapters.drawio](./assets/concepts/protocol-adapters.drawio.svg)

The inbound and outbound adapters (and the framework services) effectively provide your inner core with the ***ports*** to the outside world, which always provide the same, hence *agnostic* style of API (indicated by the green arrows used in the previous graphic), as already introduced in [Local /Remote](#local-remote).
The inbound and outbound adapters (and the framework services) effectively provide your inner core with the ***ports*** to the outside world, which always provide the same, hence *agnostic* style of API (indicated by the green arrows used in the previous graphic), as already introduced in [Local /Remote](#local--remote).

Inbound:

Expand Down
2 changes: 1 addition & 1 deletion get-started/feature-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Following is an index of the features currently covered by CAP, with status and

| Outbound Protocol Support | CDS <sup>1</sup> | Node.js | Java |
|------------------------------------------------------------------|:----------------:|:-------:|:----:|
| [REST/OpenAPI](../tools/apis/cds-import#cds-import-from-openapi) | <X/> | <X/> | <X/> |
| [REST/OpenAPI](../tools/apis/cds-import#cdsimportfromopenapi) | <X/> | <X/> | <X/> |
| OData V2 | <X/> | <X/> | <X/> |
| OData V4 | <X/> | <X/> | <X/> |
| GraphQL<sup>2</sup> | <C/> | <C/> | <C/> |
Expand Down
Loading
Loading