Skip to Content
0
Jul 23, 2021 at 10:04 AM

CAP Java: only 1 error message is returned at a time from service request

147 Views Last edit Jul 23, 2021 at 10:10 AM 2 rev

I have created a cds entity with multiple validations such as mandatory and range:

entity Authors : cuid {
        @mandatory firstname : String(111);
        @mandatory lastname  : String(111);
        @assert.range : [
        0,
        100
    ]   age : Integer; 
        books     : Association to many Books on books.author = $self;
    }

However, when the user submitted an invalid record, the service only return 1 error message at a time even though there suppose to be multiple errors. Sample query:

curl -X POST http://localhost:8080/odata/v4/AdminService/Authors \
-H "Content-Type: application/json" \
-d '{"ID": "286ae4b1-b845-4af8-9827-4eb04fe5f382", "firstname": "Jenn", "age": 120}'

By right this should returned 2 error messages(missing lastname, age out of range), however the backend service only return 1 error message.

The second error message only shows up when the first error is fixed, in this case when I provided the value for lastname:

Is this consider a bug in CAP Java as CAP nodejs seems like able to return all the error message at once?

Attachments