cancel
Showing results for 
Search instead for 
Did you mean: 

Sample application for feature bypass_draft

Dinu
Contributor
0 Kudos

Is there a sample application demonstrating the feature bypass_draft?

The animation in the release note appeared to be using sap_sample/cap_sflight. I tried to enable the feature in the main branch. But got errors (in travel-service.js:146) while doing the same steps as in the demo animation.

[odata] - > PATCH Travel(TravelUUID='75757221A8E4645C17002DF03754AB66',IsActiveEntity=true)
[cds] - TypeError: to_Booking is not iterable
    at TravelService.<anonymous> (\cap-sflight\srv\travel-service.js:146:29)

Fixing this as below did not help to get further to reproduce the demonstration.

if (to_Booking) 
for (const booking of to_Booking) {..

This threw validation errors. I guess the application logic in the sample is not adapted for this feature.

Where can I get hold of the sample application used in the demonstration?

I tried to enable the feature in the sample application generated by cds add sample. This caused the server to crash when editing a record using the Edit button on the list to change the price of one Book.

[odata] - > PATCH Books(ID=201,IsActiveEntity=true)
[cds] - TypeError: Cannot read properties of undefined (reading '@Common.DraftRoot.ActivationAction')<br>    at cds.ApplicationService.handle (\capv7-bypass-draft\node_modules\@sap\cds\libx\_runtime\fiori\lean-draft.js:392:46)

Patching the code that caused this error helped to edit price. But changing stock throws another error:

[cds] - DeserializationError: Error while deserializing payload
    at BufferedWriter.<anonymous> (\capv7-bypass-draft\node_modules\@sap\cds\libx\_runtime\cds-services\adapter\odata-v4\okra\odata-server\deserializer\DeserializerFactory.js:233:18

So I am also wondering if this feature is released for productive use at all. Would you have had better experience using this feature than I had? The release note does not mention that this feature is released as preview?

PS: Using cds version 7.5.2

View Entire Topic
MioYasutake
Active Contributor
0 Kudos

Upgrading @Sap/cds version to 7.6.1 resolved the issue.

Marian_Zeis
Active Contributor
0 Kudos
Was already with 7.5 3 🙂