Specify example requests for swagger's "Try it out"
With ASP.NET Core 3.1, Swagger OAS 3 and Swashbuckle.AspNetCore 5.4.1, the following model class + XML comments works for me:-
/// <summary> /// A user. /// </summary> public class User { /// <summary> /// The user's first name. /// </summary> /// <example>Jane</example> public string FirstName { get; set; } /// <summary> /// The user's last name. /// </summary> /// <example>Austin</example> public string LastName { get; set; } }
Now when I click "Try it Out" (for a POST operation that takes a User
model in the message body), I get the defaults:-
{ "firstName": "Jane", "lastName": "Austin"}