-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Given the following
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
app.UseSwagger();
app.MapGet("/test", (string filter) => "ok")
.WithOpenApi(o => o
.WithParameterDescription("filter", "Description for filter querystring parameter")
);
app.Run();
public static class Extensions
{
public static OpenApiOperation WithParameterDescription(this OpenApiOperation openApiOperation, string parameterName, string description)
{
var openApiParameter = openApiOperation.Parameters.Single(p => p.Name.Equals(parameterName, StringComparison.OrdinalIgnoreCase));
openApiParameter.Description = description;
return openApiOperation;
}
}
Swashbuckle.AspNetCore v6.7.3
generates the parameter with a description
{
"parameters": [
{
"name": "filter",
"in": "query",
"description": "Description for filter querystring parameter",
"required": true,
"schema": {
"type": "string"
}
}
]
}
Swashbuckle.AspNetCore v6.8.0
omits the description
{
"parameters": [
{
"name": "filter",
"in": "query",
- "description": "Description for filter querystring parameter",
"required": true,
"schema": {
"type": "string"
}
}
]
}
@jgarciadelanoceda I suspect this is due to changes introduced in #3059
jgarciadelanoceda