cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hello colleagues!


We are running a project on top NodeJS using CAP. We noticed a few weeks ago that the annotation @mandatory in the .cds file does not work for Function Modules.

I tested with the following annotations:

- @mandatory: https://cap.cloud.sap/docs/guides/generic#mandatory
- @FieldControl.Mandatory: https://cap.cloud.sap/docs/guides/generic#mandatory
- @Common.FieldControl.Mandatory:

None of them worked, so I'm not sure if they are supposed only to work with OData v2 or v4 API calls.

Here's a action in CDS as example:

action addGoal(
description : String(200) @mandatory,
targetCompletionDate : Timestamp @mandatory,
isPrivate : Boolean @mandatory );

In the example, we can add not null after the word Timestamp, and it becomes required. But for Strings as in description, adding not null wouldn't be enough to detect a blank string.

Do you know how to enable these annotations to work or if it's a known bug for CAP?


Thanks!

0 Likes
View Entire Topic
vitaly_kozyura
Advisor
Advisor

Hi,

With the next CAP release the @mandatory check will be also applied for actions and functions having typed parameters. Also the String parameters annotated with @mandatory will be checked for being empty strings. You can follow CAP releases at https://cap.cloud.sap/docs/releases/.

Best regards,

Vitaly