generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add static property
elements
to entity classes (#345)
- Loading branch information
Showing
6 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace elements_test; | ||
|
||
aspect A1 { | ||
A_f1 : String; | ||
A_f2 : String; | ||
} | ||
|
||
entity E1 { | ||
key ID: Integer; | ||
a : String; | ||
b : Integer; | ||
} | ||
|
||
entity E2 : A1 { | ||
key ID: String; | ||
d: Integer; | ||
} | ||
|
||
entity P1 as projection on E2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import cds from '@sap/cds' | ||
import { E1, E2, P1 } from '#cds-models/elements_test' | ||
|
||
E1.elements | ||
E1.elements.ID | ||
E1.elements.a | ||
E1.elements.b | ||
// @ts-expect-error | ||
E1.elements.nonExistent | ||
|
||
E2.elements | ||
E2.elements.d // from entity E1 | ||
E2.elements.A_f1 // from aspect A1 | ||
|
||
// check projection | ||
P1.elements | ||
P1.elements.ID | ||
P1.elements.d | ||
P1.elements.A_f1 | ||
P1.elements.A_f2 | ||
|
||
// check LinkedDefinitions types | ||
E1.elements.a.type | ||
E1.elements.a.kind | ||
E1.elements.a.items | ||
E1.elements.a instanceof cds.builtin.classes.String |