on 2024 Dec 31 11:56 AM
After generating my CAP project, I want to import and use external service odata (OP or Private Cloud). If I download an edmx odata v2 file from sap business hub api or from the AS, the command “cds import myedmx.edmx” works correctly.
However, if I take an edmx file from an odata v4 service from https://api.sap.com/api/OP_PRODUCT_0002/overview or https://api.sap.com/api/OP_PURCHASEORDER_0001/overview
or directly from AS
I got this error:
cds import ..\OP_PRODUCT_0002.edmx
Error: No metadata factory provided. Can not resolve 'com.sap.vocabularies.Common.v1'. Please add one via Strategy.setMetadataFactory(function(type, callback){})
at C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\lib\import\odata\metadataconverter\MetadataConverter.js:1095:22
at Context._getEdm (C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\lib\import\odata\metadataconverter\MetadataConverter.js:936:51)
at C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\lib\import\odata\metadataconverter\MetadataConverter.js:986:25
at new Promise (<anonymous>)
at Context.resolveType (C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\lib\import\odata\metadataconverter\MetadataConverter.js:983:16)
at C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\lib\import\odata\metadataconverter\MetadataConverter.js:1787:22
at Context._emit (C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\lib\import\odata\metadataconverter\MetadataConverter.js:185:21)
at C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\lib\import\odata\metadataconverter\MetadataConverter.js:186:30
at C:\Users\\AppData\Roaming\npm\node_modules\@sap\cds-dk\lib\import\odata\metadataconverter\MetadataConverter.js:1793:32
If i try to delete tag "'com.sap.vocabularies.Common.v1'" in metadata, i have same error but in another tag.
Specs :
VScode, Node 20.18.1(same behavior with Node 22)
"dependencies": {
"@sap-cloud-sdk/http-client": "^3.25.0",
"@sap/cds": "^8.6.0",
"@sap/cds-dk": "^8.6.1",
"express": "^4"
},
"devDependencies": {
"@cap-js/cds-types": "^0.8.0",
"@cap-js/sqlite": "^1"
},
Request clarification before answering.
This is probably a recently introduced bug. Try importing using an earlier version. For example, this is not an issue in '@sap/cds-dk@8.2'.
```
npm add -D '@sap/cds-dk@8.2'
npm exec cds import ~/Downloads/OP_PRODUCT_0002.edmx
```
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
same here. I'm using CAP JAVA. But the downgrade of dev dependencies didn't work for me. Maybe it has use my global cds-dk. .... So i switched it for a the import. npm add -g '@sap/cds-dk@7.3' . Then import and after that switch back npm add -g '@sap/cds-dk@8.6'
@cap-js/asyncapi: 1.0.2
@cap-js/openapi: 1.0.5
@sap/cds: 8.6.0
@sap/cds-compiler: 5.6.0
@sap/cds-dk: 8.2.3
@sap/cds-dk (global): 8.6.1
@sap/cds-fiori: 1.2.8
@sap/cds-foss: 5.0.1
@sap/cds-mtxs: 2.1.0
@sap/eslint-plugin-cds: 3.0.5
Node.js: v23.5.0
home: \npm\node_modules\@sap\cds-dk\node_modules\@sap\cds
testproject-cds: 1.0.0
CAP Java SDK: 3.5.0
cds4j: 3.5.0
Spring Boot: 3.3.6
Maven: 3.8.1, home: C:\Tools\maven\bin\..
Java: 21.0.5, home: \.jdks\sapmachine-21.0.5
OS: Windows 11, 10.0, arch: amd64
User | Count |
---|---|
60 | |
10 | |
8 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.