Skip to content

With Cds 8 SDM CAP plugin does not work#170

Merged
rashmiangadi11 merged 23 commits into
developfrom
containment-error-cds8
Sep 5, 2025
Merged

With Cds 8 SDM CAP plugin does not work#170
rashmiangadi11 merged 23 commits into
developfrom
containment-error-cds8

Conversation

@rashmiangadi11
Copy link
Copy Markdown

@rashmiangadi11 rashmiangadi11 commented Sep 3, 2025

Describe your changes

With Cds 8 SDM CAP plugin does not work none of the api calls work because of req.params[1[.ID which has been added to solve the odata containment issue. But with containment false req.data.ID will work hence added the check.

Any documentation

With Cds 8 SDM CAP plugin does not work none of the api calls work because of req.params[1[.ID which has been added to solve the odata containment issue. But with containment false req.data.ID will work hence added the check.

Scenario's Tested

1)Made cds 8 in leading CAP application and then tested the flow and ran integration test as well.
2)cds 8 and odata containment true in package.json as below
"cds": {
"requires": {
"auth": "jwt",
"db": "hana",
"sdm": {
"settings": {
"repositoryId": "TEST_REPO"
}
}
},
"odata": {
"containment": true
}
},and then tested the flow and ran integration test as well.
3) cds 9 with containment false and then tested the flow and ran integration test as well.
4)cds 9 with containment true and then tested the flow and ran integration test as well.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I have tested the functionality on my cloud environment.
  • I have provided sufficient automated/ unit tests for the code.
  • I have increased or maintained the test coverage.
  • I have ran integration tests on my cloud environment.
  • I have validated blackduck portal for any vulnerability after my commit.

Upload Screenshots/lists of the scenarios tested

  • I have Uploaded Screenshots or added lists of the scenarios tested in description

@yashmeet29
Copy link
Copy Markdown
Member

Please update screenshots/list-of-scenarios tested

Comment thread lib/util/index.js Outdated
Comment on lines +121 to +131
function getId(req) {
const containmentVal = cds?.env?.odata?.containment;
let idToUse;

if (containmentVal === true) {
idToUse = req.params[1].ID;
} else {
idToUse = req.data.ID;
}
return idToUse;
}
Copy link
Copy Markdown
Member

@yashmeet29 yashmeet29 Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor getId as

function getId(req) {
const isContainment = cds?.env?.odata?.containment === true;
return isContainment ? req.params[1]?.ID : req.data?.ID;
}

Comment thread lib/sdm.js
let attachment_val_create = [];
if (req.data.content) {
attachment_val_create = attachment_val.filter(attachment => attachment.HasActiveEntity === false && attachment.ID === req.params[1].ID);
attachment_val_create = attachment_val.filter(attachment => attachment.HasActiveEntity === false && attachment.ID ===attachmentID);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a space in attachment.ID ===attachmentID, make it attachment.ID === attachmentID

@rashmiangadi11 rashmiangadi11 merged commit 0536210 into develop Sep 5, 2025
9 checks passed
@rashmiangadi11 rashmiangadi11 deleted the containment-error-cds8 branch September 5, 2025 05:15
Juergen-Goebl-msggroup pushed a commit to Andreas-Meindl-msggroup/sdm that referenced this pull request Apr 14, 2026
With Cds 8 SDM CAP plugin does not work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants