I am new to ASP.NET Core and this question looks simple but I couldn't find a proper solution online. So here's the problem.
This is the structure of the class that I am using.
public class Alert
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string AlertId { get; set; }
public string Type { get; set; }
}
This is the description for the Post request API in swagger.
{
"alertId": "string",
"type": "string"
}
Since I am using [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
annotation alertId
in the post request is optional.
My aim is to hide alertId
from the post request description only.
I am using ASP.NET Core 3.1, EF Core(3.1.1) and Swashbuckle.AspDotNetCore(5.1.0).
Please Help.
Thank you.