cancel
Showing results for 
Search instead for 
Did you mean: 

CAP CDS @mandatory doesn't take into consideration an empty array property

jhodel18
Active Contributor
0 Kudos

Hi CAP Team/Community,

The @mandatory annotation seems to work only if a property is completely missing, but doesn't check if it's an array with an empty record -- see below.

I would think that CAP should also fail the mandatory check for empty arrays. Is there anything I'm missing or does this warrant a feature request?

Test without outputChannels:

Test with empty outputChannels:

Thanks and regards,

Jhodel

View Entire Topic
falcaraz
Explorer
0 Kudos

I tested it on a project and it does behave like that. I think the handler in the generic provider may be just checking if the property has any value at all, since these types are stored as NCLOB in SQL (see preview), if you use an empty array the db table would probably store "[]" as a literal which is (technically) not empty. If you want to check a different value you will have to code a custom handler

jhodel18
Active Contributor
0 Kudos

Hi francisco.javier.alcaraz.fernandez

Thanks for your response! The question is more towards whether CAP should also handle this scenario hoping to stay true to the concept of low-code/no-code.