if you are using latest version of Web API, then you get helpful information regarding data annotation attributes like Required
etc.
Example:
Domanda
I have created my WebAPI controllers' documentation using HelpPage. I have following model in my web api.
public class InfoModel
{
[Required]
public int id { get; set; }
[Required]
public string title { get; set; }
public string status { get; set; }
public string created_at { get; set; }
}
HelpPage renders InfoModel on help page like this:
{
"id": 1,
"title": "Sample string 2",
"status": "Sample string 3",
"created_at": "Sample string 4"
}
Using [Required] attribute from Model Validation and I want to highlight properties having [Required] attribute. How can I customize HelpPage MVC plugin to bold "id" and "title", so that user may know that these attributes are REQUIRED:
{
"id": 1,
"title": "Sample string 2",
"status": "Sample string 3",
"created_at": "Sample string 4"
}
I understand Jquery/CSS but for that HelpPage MVC should render HTML contents with some marking for [Required] attributes so that JS/CSS may style them differently on client side. I am expecting some modifications in Areas.HelpPage.ObjectGenerator class that is responsible for generating HTML for InfoModel.
Soluzione
if you are using latest version of Web API, then you get helpful information regarding data annotation attributes like Required
etc.
Example:
Altri suggerimenti
Use jQuery to apply css to the id
and title
:
$('foo').css("font-weight","Bold");