We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
endpoint descriptions and summaries for minimal APIs
using Microsoft.AspNetCore.OpenApi; var builder = WebApplication.CreateBuilder(args); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseHttpsRedirection(); var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; app.MapGet("/", [EndpointSummary("Sends a Hello request to the backend")] // <---- [EndpointDescription("Description: Sends hello request")] () => "Hello World!"); // <---- app.MapGet("/weatherforecast", () => { 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; }) .WithDescription("Description:Sends the weather forcast.") // <---- .WithSummary("Summary: Sends the weather forcast.") // <---- .WithName("GetWeatherForecast") .WithOpenApi(); app.Run(); internal record WeatherForecast(DateTime Date, int TemperatureC, string? Summary) { public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); }
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered:
@martincostello should this be postponed until dotnet/aspnetcore#40753 is closed?
@hwoodiwiss writes
Due to the changes to CI that will be required, it may have to wait until a bit closer to .NET 7's Release before it gets merged.
Sorry, something went wrong.
I guess so if it still doesn't work as expected.
Rick-Anderson
No branches or pull requests
endpoint descriptions and summaries for minimal APIs
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: