I have an API and I want swashbuckle to autogenerate all the swagger documentation for me.
I have an endpoint that returns a class with a dictionary property but the swagger generated example contains "additionalProp1, additionalProp2" etc instead of example values. Is there a way to instead use example values specified in the SimpleClass class?
The class with the example for swagger (that doesn't work).
public class SimpleClass
{
/// <example>"{"age":31,"height":234}"</example>
public Dictionary<string, int> DictionaryProperty { get; set; }
/// <example>The cow jumped over the moon</example>
public string someProperty { get; set; }
}
The controller
[HttpGet]
[Route("/testexample")]
[ProducesResponseType(typeof(SimpleClass), StatusCodes.Status200OK)]
public async Task<IActionResult> TestExample()
{
return Ok();
}
