-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
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
Using [AsParameters] annotation in minimal api does not lift summary comments of the model #2658
Comments
I think I'm running in to a similar issue. I'm trying to set a I have the following:
The |
Try change type |
@codelovercc Thanks for the reply. While changing it the |
@mr-davidc Welcome, I'm happy to help. services.AddSwaggerGen(options =>
{
options.SupportNonNullableReferenceTypes();
}); public class MyDto
{
public bool Encrypted {get;set;}
}
|
Hi again @codelovercc, I tried those options you mentioned above, but still my I also still have an issue where the endpoint Summary doesn't come through to Swagger UI either, UNLESS I set
Any other things I can try to fix either of these issues? |
I have the same problem. Using the data annotation |
Seems like this feature is still missing, anyone know? |
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made. |
Hi @andreasuvoss, can you test if this is solved with the addition of #2943. |
@kaloyantihomirov |
@kaloyantihomirov can you test using myGet?, my changes are already merged |
I’m not at my computer at the moment, I will try to test this sometime next week, maybe already tomorrow. |
Hi @andreasuvoss, reviewing the issues with MinimalApi, the issue is that if you use AsParameters the ContainerType is not present over the Parameters of the endpoint(The AsParametersArgument class is missing). |
Hi @martincostello, I wasn't able to get the XML parameters to work when they are members of a AsParameters request. |
Sure, that sounds sensible. |
It will be supported in dotnet10. dotnet/aspnetcore#56764 |
Closing as external. |
Swashbuckle.AspNetCore: 6.5.0
.NET 7
I am not sure if this is a bug or a feature request.
When defining APIs using the minimal API approach, the summaries from models are not lifted from the XML documentation and put into the resulting
swagger.json
like I would expect. Before migrating to minimal API we used controllers, and the[FromQuery]
annotation in a similar way. This gave the expected result. However[FromQuery]
is not supported when using minimal API, instead the[AsParameters]
annotation was added in .NET 7 .The summaries are present in the XML file generated when building the project, but not in the
swagger.json
file.I have created a minimal example showing that the summaries are not present (in both
swagger.json
or SwaggerUI) when using the[AsParameter]
annotation, but they are included in the schema on the post request using the[FromBody]
annotation.I have a very ugly workaround using the
WithOpenApi
extension method from the NuGet packageMicrosoft.AspNetCore.OpenApi
to add descriptions to the individual indices of each parameter by modifying the mapping from my minimal example like so:Minimal example:
Project file:
Program.cs:
The text was updated successfully, but these errors were encountered: