I am using dot net core 3.1, and the streamreader reads the req body as
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
Then converts the request body to required model as
var response = JsonConvert.DeserializeObject<MyModel>(requestBody);
MyModel class:
public class MyModel
{
[Required]
[MaxLength(50)]
public string Name { get; set; }
}
But the maxlength property is not working here it is simply taking string value of any length.