Skip to content

fix: restore bound operations on containment navigation paths#149

Merged
tim-sh merged 1 commit intomainfrom
fixBoundOpsOnContainmentNavs
May 5, 2026
Merged

fix: restore bound operations on containment navigation paths#149
tim-sh merged 1 commit intomainfrom
fixBoundOpsOnContainmentNavs

Conversation

@tim-sh
Copy link
Copy Markdown
Member

@tim-sh tim-sh commented May 4, 2026

This fixes a bug where actions on navigation properties are missing (regression since 1.2.0).

@tim-sh tim-sh requested a review from daogrady May 4, 2026 08:57
) {
diagram = /** @type {unknown} */(diagram) !== "false" && !!diagram;
// as preProcess below mutates the csdl, copy it before, to avoid side-effects on the caller side
csdl = JSON.parse(JSON.stringify(csdl))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not part of the PR, but I believe we were asked to use structuredClone for this scenario.

@daogrady
Copy link
Copy Markdown
Contributor

daogrady commented May 4, 2026

Do we have an open issue this PR is addressing?

@daogrady
Copy link
Copy Markdown
Contributor

daogrady commented May 4, 2026

I tried a minimal reproduction sample by creating a new project

$ cds init foo --add nodejs,sample
$ cd foo

and editing the srv/AdminService.cds like so:

using {sap.capire.bookshop as my} from '../db/schema';

service AdminService {
  entity Authors as projection on my.Authors;
  entity Books   as projection on my.Books;
  entity Genres  as projection on my.Genres;
  entity Foo {
    key id:UUID;
  } actions {
    action myAction(self: Foo) returns String;
  }
}

I ran

cds compile -2 openapi "*" -s AdminService

from the project root and when encountering the relevant portion of the CSN, I saw the following element:
Screenshot 2026-05-04 at 14 45 55

implying that actions were already not triggering the original first half of the condition to return. So on first glance, it looks like this change had no effect on bound actions.

Copy link
Copy Markdown
Contributor

@daogrady daogrady left a comment

Choose a reason for hiding this comment

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

Tried the minimal reproduction sample from the original issue. The provided bound action is indeed absent from the output when using openapi:main, but appears in the output with this change. I think we can thus consider this a valid fix. Thanks!

@tim-sh tim-sh merged commit 9889ae2 into main May 5, 2026
9 of 11 checks passed
@tim-sh tim-sh deleted the fixBoundOpsOnContainmentNavs branch May 5, 2026 08:05
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.

2 participants