cds-routing-handlers icon indicating copy to clipboard operation
cds-routing-handlers copied to clipboard

onRead not called for $expand

Open Fjaoos opened this issue 2 years ago • 4 comments

Hi,

firstly let me thank you for your package.

We are working with an entity called BusinessPartnerRequest which has a navigation property called comment that leads to the entity Comments. We registered a handler for both entity and both methods which are decorated with onRead are called. However, when we try to use the $expand option, the handler for comment is not called.

How is it possible to hook into the expanded read event?

Regards fjaoos

Fjaoos avatar Jul 11 '22 07:07 Fjaoos

This also seems to be the case when we are creating a deep BusinessPartnerRequest Entity with a comment entity attached to it.

Fjaoos avatar Jul 11 '22 07:07 Fjaoos

Hi @Fjaoos,

can you create a short PoC which does not use cds-routing-handlers but the native CAP way. I seem to remember that CAP does not trigger the events for the child entity on an $expand. Can you please check this briefly in a PoC, if CAP triggers these events, or if it is due to cds-routing-handlers. cds-routing-handlers uses the CAP events, if they are not triggered, we can't cover this in cds-routing-handlers either, unfortunately.

Regards Simon

HeneryHawk avatar Jul 11 '22 16:07 HeneryHawk

Hi @HeneryHawk ,

thank you for your suggestion. I cloned the CAP sample repo https://github.com/SAP-samples/cloud-cap-samples and added this to the catalog-service: image

The program stops at the debugger statement when called with http://localhost:4004/browse/Genres but not when called with http://localhost:4004/browse/Books?$expand=genre

So you did remember that correctly.

Is it possible to add this to the documentation?

Fjaoos avatar Jul 12 '22 07:07 Fjaoos

Hi @Fjaoos

sorry, but then cds-routing-handlers doesn't call the decorated method either.

I will extend the documentation.

Regards

HeneryHawk avatar Jul 12 '22 15:07 HeneryHawk