Changing display name in Model to show in response

Viewed 576

I am looking for a way to change the display Name of a property in Model so that the same would be reflect in the response body in swagger.

I tried using DisplayName attribute for the field but it doesn't seem to be working.

[DisplayName("Fucntion ID")]
public string FunctionId { get; set; }

[DisplayName("Function Description")]
public string FunctionDEscription { get; set; }

Image

Is there any other way to achieve this? Thanks in advance.

2 Answers

I got the answer-

Used [JsonPropertyName("Fucntion ID")] instead of [DisplayName("Fucntion ID")]

Related