question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using WithSummary() for Minimal API endpoints does not render when using Swashbuckle.AspNetCore

See original GitHub issue

Is 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

image

Using WithSummary()

image

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:closed
  • Created 2 years ago
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
captainsafiacommented, Aug 16, 2022

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 the OpenApiOperation.

app.MapGet("", () => ..)
  .WithOpenApi(o => {
    o.Summary = "Summary";
  });

Edit: you need to use the latest version of Swashbuckle to light up this feature E2E.

1reaction
hwoodiwisscommented, Aug 15, 2022

Hi, I am using the latest .NET 7 preview and this is still an issue. I cannot display summary, description, nor produces. Is there any update on this?

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swashbuckle doesn't detect my API endpoints
I have a large Umbraco 10 application (running on .net core 6.0) and I'm trying to set up Swagger/Swashbuckle (using 6.5.0) to document...
Read more >
What's new in ASP.NET Core 7.0
OpenApi package and the endpoints that are defined in Minimal APIs. The package provides an API that examines an endpoint's parameters, ...
Read more >
Swashbuckle.AspNetCore
Swagger tooling for APIs built with ASP.NET Core. Generate beautiful API documentation, including a UI to explore and test operations, directly from your ......
Read more >
Configuring and Using Swagger UI in ASP.NET Core Web ...
We are going to learn how to integrate the Swagger UI/OpenAPI in an ASP.NET Core Web API, extend the documentation, and customize UI....
Read more >
肖红军/Swashbuckle.AspNetCore
At its core, there's a Swagger generator, middleware to expose it as JSON endpoints, and a packaged version of the swagger-ui. These 3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found