I need Swagger generate XML API file documentation, include UI to test operations.
When use ASP.NET in my project, deps XML files are generated, everything is OK.
I've set:
-Project File documentation
-Wrote and get the path
var filePath = Path.Combine(System.AppContext.BaseDirectory, "Minimal_API.xml");
x.IncludeXmlComments(filePath);
And when I run my project, the comments don't show up.
/// <summary>
/// Gets the list of all records
/// </summary>
app.MapGet("/weatherforecast2", () =>
{
var summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast
(
DateTime.Now.AddDays(index),
Random.Shared.Next(-20, 55),
summaries[Random.Shared.Next(summaries.Length)]
))
.ToArray();
return forecast;
})
Create new tag: minimal-api

app.MapGetis a local call which is not a valid target for XML comment. Check out the generated xml - it should be empty.