cds-routing-handlers
cds-routing-handlers copied to clipboard
onRead not called for $expand
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
This also seems to be the case when we are creating a deep BusinessPartnerRequest Entity with a comment entity attached to it.
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
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:
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?
Hi @Fjaoos
sorry, but then cds-routing-handlers doesn't call the decorated method either.
I will extend the documentation.
Regards