Skip to content
Open
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
50 changes: 48 additions & 2 deletions cds/cdl.md
Original file line number Diff line number Diff line change
Expand Up @@ -2070,8 +2070,8 @@ service Zoo {

```cds
extend service Zoo with { // auto-exposed entities:
@readonly entity Foo_bar as projection on Bar;
@readonly entity Foo_car as projection on Car;
entity Bar as projection on my.Bar;
entity Car as projection on my.Car;
}
```

Expand All @@ -2084,6 +2084,52 @@ service MyOrders {
}
```

Auto-exposure of entities annotated with `@cds.autoexpose` can be switched off for a
particular service by annotating the service with `@cds.autoexpose: false`:
```cds
@cds.autoexpose: false
service Zoo {
// ...
// Bar and Car are not auto-exposed in this service
}
```

In addition to entities annotated with `@cds.autoexpose`, composition targets are auto-exposed, too.

Example:
```cds
// schema.cds
namespace travels;
entity Travels {
key id : Integer;
bookings : Composition of many Bookings on Bookings.Travel = $self;
}
entity Bookings {
key Travel : Association to Travels;
key Pos : Integer;
}
```

When `Travels` is exposed in a service ...

```cds
using { travels } from './schema.cds';
service TravelService {
entity Travels as projection on travels.Travels
}
```

... the composition target `Bookings` is auto-exposed, like

```cds
extend service TravelService with { // auto-exposed entity:
entity Bookings as projection on travels.Bookings;
}
```

This auto-exposure of composition targets is not affected by annotating
service `TravelService` with `@cds.autoexpose: false`.

[Learn more about **CodeLists in `@sap/cds/common`**.](./common#code-lists){.learn-more}


Expand Down
Loading