Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Api ModelState validation is ignoring the DisplayAttribute

Given a model with these data annotations:

public class Example
{
    [Required]
    [Display(Name = "Activity response")]
    public string ActivityResponse { get; set; }
}

I would expect the model state error message to be "The Activity response field is required." Instead it is "The ActivityResponse field is required."

like image 276
Jeremy Cook Avatar asked Jan 03 '13 15:01

Jeremy Cook


1 Answers

Hooray! The codeplex issue reports that this bug will be fixed in Web API v5.1 Preview.

like image 114
Jeremy Cook Avatar answered Nov 15 '22 08:11

Jeremy Cook