Using WithSummary() for Minimal API endpoints does not render when using Swashbuckle.AspNetCore
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
Using the new WithSummary()
method (or [EndpointSummary]
attribute) on a Minimal API endpoint in ASP.NET Core Core 7 preview 2 does not render the summary in the OpenAPI document generated by Swashbuckle.AspNetCore.
I figure this is because Swashbuckle.AspNetCore would need changes to consume the new metadata to use and output it, but as I thought I’d raise this for visibility as I couldn’t immediately see anything in the backlog related to this and because #37906 is closed which seems to imply it should “just work™️”.
Using SwaggerOperationAttribute
Using WithSummary()
Expected Behavior
The string passed to the WithSummary()
method of [EndpointSummary]
attribute is rendered in the OpenAPI JSON document generated by Swashbuckle.AspNetCore.
Steps To Reproduce
Clone https://github.com/martincostello/api/commit/66fbf8e8803efed640c8c6c75c432e49b7f32e63, run the application, and navigate to the /docs
URL in a browser.
Exceptions (if any)
N/A
.NET Version
7.0.100-preview.2.22153.17
Anything else?
N/A
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (12 by maintainers)
Top GitHub Comments
Howdy folks!
I’m going to close this issue for now since it is external to ASP.NET Core (Swashbuckle needs to pick up the ISummaryMetadata attributes).
Furthermore, for the long term, we are recommending that folks leverage the new
WithOpenApi
to modify the summary and other aspects of theOpenApiOperation
.Edit: you need to use the latest version of Swashbuckle to light up this feature E2E.
Yeah, there’s a PR open with the fix here: domaindrivendev/Swashbuckle.AspNetCore#2414 but it hasn’t been merged yet. I’ll be looking to get it reviewed and merged when the first RC for .NET 7 is released.