Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b7a74ca
Set release status
chgeo Apr 30, 2023
d15cb44
Set release status
chgeo Apr 30, 2023
09ce1e4
Checkmark styling: use consistent char
chgeo May 1, 2023
19f3ae4
Support comma-sep csv syntax
chgeo May 1, 2023
c45c817
Update aspects.md (#115)
BraunMatthias May 2, 2023
979dbea
Add docu for "additional odata vocabs" (#117)
stewsk May 2, 2023
45644e0
Describe OpenType support in OData v4 (#94)
eugene-andreev May 2, 2023
cff702e
@cds.localized and expanded entities (#105)
mariayord May 2, 2023
c8f15b8
Fix layout and other glitches in `about` (#119)
chgeo May 2, 2023
b635449
Minor cosmetics
danjoa May 2, 2023
2bb6908
Don't use IndexList (-> in general)
danjoa May 2, 2023
ed522c8
New cds.Services Guide
danjoa May 2, 2023
0b2cf53
fixed link
danjoa May 2, 2023
ba681c9
.
danjoa May 2, 2023
b455a96
Fix link
chgeo May 2, 2023
95f73d9
Fix styling of some synopsis
chgeo May 2, 2023
70d39e6
Fix anchor links
chgeo May 2, 2023
6317b80
Relace images w/ code by code blocks
chgeo May 2, 2023
b6bc328
Fix cds snippet
chgeo May 2, 2023
bdb198d
Another cds snippet error
chgeo May 2, 2023
28d9d67
Split code block
chgeo May 2, 2023
a9ea043
Advanced - OData: updated links and naming (#121)
renejeglinsky May 3, 2023
a5de7ae
cds import : updating doc for asyncapi import (#111)
muskansethi1 May 3, 2023
745dd61
fix: app-specific settings via cds.env (#120)
sjvans May 3, 2023
a03ef91
cds.env: better styling and code groups
chgeo May 3, 2023
95b203b
Update odata.md (#122)
renejeglinsky May 3, 2023
1943daa
Revised cds.ApplicationService docs
danjoa May 3, 2023
c368f60
..
danjoa May 3, 2023
94ad71f
.
danjoa May 3, 2023
de2032e
minor cleanup
danjoa May 4, 2023
fdfd9b0
Fix anchor links
chgeo May 4, 2023
a5aeabc
Moving (#123)
renejeglinsky May 4, 2023
03d7ca1
Fix link
chgeo May 4, 2023
7c6261b
Fix missing links (#125)
tim-sh May 4, 2023
4fe95cb
annotations.md: Fix missing URLs to some guides (#127)
bugwelle May 4, 2023
52705ba
cds import : minor change (#124)
muskansethi1 May 4, 2023
08b31d7
Update docu in Open Types (#128)
agoerler May 4, 2023
1b6464b
Handle initial java/node state
chgeo May 4, 2023
d1d97ff
Update Java properties from 1.34.0
chgeo May 4, 2023
1df40e8
Fix more dead links
chgeo May 4, 2023
52ac8b1
Better 2 column layout in about page
chgeo May 4, 2023
0c05d45
Adjusted links to core-services
danjoa May 5, 2023
af8508f
Remove superfluous style
chgeo May 5, 2023
f4d6a33
Fix anchor link
chgeo May 5, 2023
3dd20df
CDL: Use `cds` for code blocks instead of `swift` (#129)
bugwelle May 5, 2023
4b2e171
Use default `Inter` font as fallback
chgeo May 5, 2023
a0248b7
fixed error
renejeglinsky May 5, 2023
63d8716
.
renejeglinsky May 5, 2023
8ed392e
fix error
renejeglinsky May 5, 2023
d9624da
Dummy changed
chgeo May 5, 2023
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
Prev Previous commit
Next Next commit
cds import : updating doc for asyncapi import (#111)
* updating for asyncapi import

* revert change

* added table and some edits

---------

Co-authored-by: Rene Jeglinsky <[email protected]>
  • Loading branch information
muskansethi1 and renejeglinsky authored May 3, 2023
commit a5de7ae0a9dc273c38c2dc2ad8c49c5552d405f2
15 changes: 11 additions & 4 deletions guides/using-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,15 @@ By default, CAP works with OData V4 and the EDMX export is in this protocol vers
Import the API to your project using `cds import`.

```sh
cds import ~/Downloads/API_BUSINESS_PARTNER.edmx --keep-namespace --as cds
cds import <input_file> --as cds
```

| Option | Description |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--keep-namespace` | Keep the namespace of the existing service. Otherwise, the namespace is changed to the file's base name when converting the file to CSN.<br> **Note:** In this example, it would be still `API_BUSINESS_PARTNER`. |
| `--as cds` | The import creates a CDS file (for example _API_BUSINESS_PARTNER.cds_) instead of a CSN file. |


This adds the API in CSN format to the _srv/external_ folder and also copies the EDMX file into that folder. Additionally, for **Node.js** it adds the API as an external OData service to your _package.json_. You use this declaration later to connect to the remote service [using a destination](#use-destinations-with-node-js).
This adds the API in CDS format to the _srv/external_ folder and also copies the input file into that folder. Additionally, for **Node.js** it adds the API as an external service to your _package.json_. You use this declaration later to connect to the remote service [using a destination](#use-destinations-with-node-js).

```json
"cds": {
Expand Down Expand Up @@ -189,9 +188,17 @@ Now run `cds import <filename>`
- `--force` is applicable only in combination with `--as` option. By default the `--force` flag is set to false.
> If set to true, existing CSN/CDS files from previous imports are overwritten.

The kind `odata-v2` is set when importing EDMX definitions of OData V2 format. When importing OData V4, the kind `odata` is set, which is an alias for kind `odata-v4`.
When importing definitions, the `kind` is set according to the following mapping:

|Imported Format | Used `kind` |
|---------|---------|
| OData V2 | `odata-v2` |
| OData V4 | `odata` (alias for `odata-v4`) |
| OpenAPI | `rest` |
| AsyncAPI | `odata` |

[Learn more about type mappings from OData to CDS and vice versa.](../node.js/cds-dk#special-type-mappings){.learn-more}

::: tip
Always use OData V4 (`odata`) when calling another CAP service.
:::
Expand Down
16 changes: 15 additions & 1 deletion node.js/cds-dk.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const cds = require('@sap/cds-dk')

## <span style="color:#800; font-weight:500">cds</span>.import <i> (file, options) &#8594; [csn](../cds/csn) </i> { #import }

As an application developer, you have the option to convert OData specification (EDMX / XML), or OpenAPI specification (JSON) files to CSN from JavaScript API as an alternative to the `cds import` command.
As an application developer, you have the option to convert OData specification (EDMX / XML), OpenAPI specification (JSON) or AsyncAPI specification (JSON) files to CSN from JavaScript API as an alternative to the `cds import` command.

> `cds.import` is available in the CDS development tool kit *version 4.3.1* onwards .

Expand Down Expand Up @@ -90,6 +90,15 @@ const csn = await cds.import.from.openapi(OpenAPI_JSON_file)
```
<br>

## <span style="color:#800; font-weight:500">cds</span>.import.from.asyncapi <i> (file) &#8594; [csn](../cds/csn) </i> { #import-from-asyncapi }

This API can be used to convert the AsyncAPI specification file (JSON) into CSN.
The API signature looks like this:
```js
const csn = await cds.import.from.asyncapi(AsyncAPI_JSON_file)
```
<br>

Example:

```js
Expand All @@ -100,10 +109,14 @@ module.exports = async (srv) => {
cds.import('./odata_sample.edmx', { includeNamespaces: 'sap,c4c', keepNamespace: true }),
// for openapi
cds.import('./openapi_sample.json'),
// for asyncapi
cds.import('./asyncapi_sample.json'),
// for odata
cds.import.from.edmx('./odata_sample.xml', { includeNamespaces: '*', keepNamespace: false }),
// for openapi
cds.import.from.openapi('./openapi_sample.json')
// for asyncapi
cds.import.from.asyncapi('./asyncapi_sample.json')
]);

for (let i = 0; i < csns.length; i++) {
Expand All @@ -129,3 +142,4 @@ The following mapping is used during the import of an external service API, see
| _Edm.DateTime<br>Precision : Second_ <sup>1</sup> | `cds.DateTime` + `@odata.Type:'Edm.DateTime'` + `@odata.Precision:0` |

<sup>1</sup> only OData V2