Open KristianHebert opened 1 year ago
Null values should be omitted as stated in the documentation: https://learn.microsoft.com/en-us/odata/webapi/action-parameter-support#null-value And the the null value is not accepted by the server which fails with an invalid modelstate. If the null valued entities are omitted, the Action works.
OData 7.16.0
Odata connected service 2022+
Microsoft Visual Studio Enterprise 2022 (64-bit) Version 17.5.4
Make an action that takes an entity parameter and checks for ModelState.IsValid
if the entity is sent with value = null, the modelstate is invalid, and no other parameters can be read.
Client should generate a message without the entity in the posted json, when the value is null. This is accepted by the server.
The client generates a message with the entity, and a value of null: {"CustomerText":null}
This is rejected by the server
I tried to modify the request by looking at the OnEntryStarting event, but this does not seem to be working anymore, and the unittests have been commented away three years ago.
Null values should be omitted as stated in the documentation: https://learn.microsoft.com/en-us/odata/webapi/action-parameter-support#null-value And the the null value is not accepted by the server which fails with an invalid modelstate. If the null valued entities are omitted, the Action works.
Assemblies affected
OData 7.16.0
Odata connected service 2022+
Microsoft Visual Studio Enterprise 2022 (64-bit) Version 17.5.4
Reproduce steps
Make an action that takes an entity parameter and checks for ModelState.IsValid
if the entity is sent with value = null, the modelstate is invalid, and no other parameters can be read.
Expected result
Client should generate a message without the entity in the posted json, when the value is null. This is accepted by the server.
Actual result
The client generates a message with the entity, and a value of null: {"CustomerText":null}
This is rejected by the server