Using data annotations with the help of MetadataTypeAttribute doesn't seem to be working with ASP.NET Web API Help Page. Not even sure if the data annotations actually work with MetadataTypeAttribute, but looks like it should... based on this link. We need to specify data annotations using different classes because the primary models are being used by other portable class libraries, in which these libraries cannot use the data annotations used with ASP.NET Web API.
[MetadataType(typeof(UserInfoMetadata))]
public partial class UserInfoViewModel
{
}
public class UserInfoMetadata
{
[Required]
[Display(Name = "Email")]
public string Email { get; set; }
}
Looking at the sample model above, RequiredAttribute has been specified. That said, it should be displayed on the additional information column for the "Email" field or property. Specifying data annotations without using MetadataType attributes seem to be working fine.