cancel
Showing results for 
Search instead for 
Did you mean: 

Update virtual and @readonly fields

klaus_kopecz
Participant

Dear CAP Team,

Not sure whether it is a bug or a feature: When I'm sending PUT requests to update virtual fields or fields annotated with @readonly, updating is not happening (correct!), but the response status is 200 OK. So, the http client gets no indication that he is trying to work against the model. (cds version 3.31.2 on Node.js). The response body shows 'null' as value of such fields. The client needs to compare request and response to figure out that something didn't work as expected.

I would consider such request to result in an error, but I don't know what others think about it ... ?

Klaus

Accepted Solutions (1)

Accepted Solutions (1)

david_kunz2
Advisor
Advisor
0 Kudos

Hi Klaus,

Personally I also would expect errors, however according to the OData specification those fields are just ignored. So the runtime behaviour is correct.

Best regards,
David

klaus_kopecz
Participant
0 Kudos

Thanks David. However, we have plain REST as well and others maybe in the future. Maybe CAP can not always rely on an existing specified behavior.

alicegavanelli
Participant

Hello,

I think CAP should change this OData standard behaviour.

One possible solution could be adding a new parameter in cds config:

runtime: {
  newParam: false
}

Best

Alice

Answers (0)