I am developing ASP.NET Core 2.1 REST Api with field level security, which means e.g. that each property of current user's response object is checked for adequate permission and if doesn't have it, it is not serialized to JSON response.
But for JSON request (api endpoint call) I would like to return error when user tries to send property to which he has no permission. Example:
public async Task<IActionResult> AddDevice([FromBody] DeviceViewModel deviceViewModel)
{
// do something
}
Maybe eventually I will not use this error approach, but I need a way to distinguish DeviceViewModel
properties which were send by a client in JSON - from properties which were set by BodyModelBinder
to their types default values.
Is there any simple way to achieve this?