cloud-sdk-js
cloud-sdk-js copied to clipboard
Client Generation fails for OData v4 service with EDMX Version 4.01
Describe the Bug
During generation of a client for OData v4, Generator fails to generate the client if edmx Version is 4.01 instead of 4.0. Both the versions are valid as mentioned in the OASIS ODATA documentation
Sample EDMX can be downloaded from SalesOrder (A2X) OData V4
Error Output
[2025-04-15T11:15:33.374Z] ERROR (cli): ErrorWithCause: Generation of services failed.
at /Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/cli.js:14:18
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Caused by:
TypeError: Cannot read properties of undefined (reading 'split')
at /Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/entity.js:26:51
at Array.map (<anonymous>)
at navigationProperties (/Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/entity.js:25:42)
at /Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/entity.js:19:31
at Array.map (<anonymous>)
at generateEntitiesV2 (/Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/entity.js:17:29)
at getServiceEntitiesV2 (/Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/service-entities.js:14:54)
at ServiceGenerator.generateService (/Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/service-generator.js:27:54)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Promise.all (index 0)
Cloud SDK Generator Version
npx generate-odata-client --version provides output 4.0.2
Node version
Node version used 22.14.0
Steps to Reproduce
- Install the generator using following command as part of your project (local to your project)
npm install -D @sap-cloud-sdk/generator
- Execute the command to generate the client
npx generate-odata-client --input srv/external/CE_SALESORDER_0001.edmx --outputDir srv/external/clients --verbose --optionsPerService srv/external --skipValidation --overwrite
- Command errors out without any files being created.
- Following Error sample is shown:
[2025-04-15T11:15:33.374Z] ERROR (cli): ErrorWithCause: Generation of services failed.
at /Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/cli.js:14:18
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Caused by:
TypeError: Cannot read properties of undefined (reading 'split')
at /Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/entity.js:26:51
at Array.map (<anonymous>)
at navigationProperties (/Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/entity.js:25:42)
at /Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/entity.js:19:31
at Array.map (<anonymous>)
at generateEntitiesV2 (/Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/entity.js:17:29)
at getServiceEntitiesV2 (/Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/edmx-to-vdm/v2/service-entities.js:14:54)
at ServiceGenerator.generateService (/Users/<projectpath>/node_modules/@sap-cloud-sdk/generator/dist/service-generator.js:27:54)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Promise.all (index 0)
Faster way to reproduce the error for contributors
- Change the version to
4.01in sample filetest-resources > odata-service-specs > v4 > API_TEST_SRV > API_TEST_SRV.edmx - Run the generate command
yarn generateor Run the test commandyarn test - Generation and Test cases would start failing
Expected Behavior
- Generation of client should succeed
- No errors should be displayed due to the version difference
Screenshots
No response
Used Versions
- Node version via
node -v: 22.14.0 - NPM version via
npm -v: 10.9.2 - SAP Cloud SDK version: 4.0.2
- For CAP users, CAP version: 8.8.2
Code Examples
No response
Log File
No response
Affected Development Phase
Getting Started
Impact
Blocked
Timeline
No response
Additional Context
No response
Hi @preetamkajalrout, thanks for raising this issue & PR.
I've discussed this with our PO, and we came to the conclusion that for proper 4.X support, we would need to implement a longer list of new features, tests, etc.
Based on the demand, we can't prioritise proper support for this version yet.
As a workaround, you can adjust the line you've modified in your PR in the node_modules instead, or alternatively, fork the project with your PR's change in place.
Let me know if you need any assistance for the workaround.
Adding our PO @jjtang1985 to the conversation, in case demand for this version increases.
Hi @preetamkajalrout, thanks for raising this issue & PR.
I've discussed this with our PO, and we came to the conclusion that for proper 4.X support, we would need to implement a longer list of new features, tests, etc.
Based on the demand, we can't prioritise proper support for this version yet.
As a workaround, you can adjust the line you've modified in your PR in the node_modules instead, or alternatively, fork the project with your PR's change in place.
Let me know if you need any assistance for the workaround.
Hi @tomfrenken , I understand. I have been using the workaround for my current project. Thanks for your suggestion and would be happy to contribute in any capacity if this support is being implemented in future.
Hi @preetamkajalrout,
I have added a BLI to track this issue. Please follow the item for further updates on the issue.
Hi @preetamkajalrout,
I have added a BLI to track this issue. Please follow the item for further updates on the issue.
Hi @KavithaSiva , Thanks for creating a backlog item. But it looks like there is no way to follow the item. Probably I don't have access to the repository and it is not public. Can you guide me how I can follow the issue.
Apologies, it is a private repo, I will keep this issue open instead to track progress.