I'm trying to disabled default? feature of web api. Currently I have post method in api controller with class as input:
[HttpPost]
public IActionResult MyMethod(MyClass class)
public class MyClass
{
public bool FirstProp {get;set;}
public decimal SecondProp {get;set;}
}
that contains bool and decimal required values. When I send json with this values as null, my api behaves ok, it throws exception that value is invalid for specified column.
The problem is when I don't send this column (example json: { }
) and I get in controller method class with default values (in my case false for FirstProp type and 0 for SecondProp type). What is the best way to block this kind of serialization/mapping for my post method controller ?