-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Add built-in support for Swagger UI #55191
Comments
Just as a FYI (I have no problems with ASP.NET Core shipping its own SwaggerUI component), but Swashbuckle.AspNetCore has rebooted development (see domaindrivendev/Swashbuckle.AspNetCore#2778). We have work in-flight to add support for .NET 8 (domaindrivendev/Swashbuckle.AspNetCore#2799), will likely have support for .NET 9 later this year, and we're trying to get our SwaggerUI support working with native AoT (domaindrivendev/Swashbuckle.AspNetCore#2800). With those changes, you'd be able to use Swashbuckle's SwaggerUI functionality with the new OpenAPI functionality (I think!) as long as it's configured to know where the OpenAPI document is to fetch it if it's not at the same URL as it would be if Swashbuckle were rendering it. With it no longer being in the templates, you'd just need to explicitly pull in the package reference and configure the services/middleware. |
Ok, very good news and I didn't know that development had finally resumed. Perhaps in this case my proposal is no longer really necessary. |
Unlikely, as that's the majority of what Swashbuckle does already. It would be a bit like getting NLog to reimplement itself in terms of Microsoft.Extensions.Logging - you wouldn't do that, you'd just use one or the other (maybe not the best analogy, as NLog is compatible with M.E.Logging...). If there's new capabilities in ASP.NET Core itself, System.Text.Json or new C# language features as part of .NET 9, we'll look to support them where it makes sense. |
Thank you for the reply. In this case I still think it's useful that ASP.NET Core ships its own SwaggerUI component. Let's see the opinion of the other contributors. |
I imagine there will be plenty of third party packages (.. or at least one, which is all we really need..) that gives you a Swagger UI (or Redoc, or whatever) based on the first-party Microsoft OpenAPI document support. |
@joegoldman2 Thanks for filing this issue! We don't plan on adding built-in support for Swagger UI as part of the work that we are doing here. You can read more about the scope of the work in this issue. The TL;DR is that we don't want to take a strong opinion on what dev-time UI developers use to interact with the OpenAPI document we generate. Swagger UI is an option, but there's a variety of other tools in the space (Redoc mentioned by @KennethHoff above, Postman, Thunderclient) that give you the ability to visualize the APIs in your app.
Yep, you should be able to use Swashbuckle's Swagger UI endpoint (or NSwag's for that matter) and point it to the JSON file we generate to produce the desired experience. |
Thank you for your reply. I understand and that's fair. I'm going to close this proposal. |
Introduction
With #55182, support for generating OpenAPI specification files has been added. However, the related feature to visualize these files, like Swagger UI, hasn't been included (and not planned from what I understood). This proposal aims to suggest the add of Swagger UI support within the framework to make it easier to visualize OpenAPI definitions.
Motivation
Visualizing OpenAPI Specification files is important for a better development experience. Swagger UI, with its easy-to-use interface and interactive documentation, helps developers to explore APIs in a practical way and test them easily (especially during the development phase).
Also, starting with .NET 9, users will migrate to the built-in feature to generate OpenAPI specifications (especially because Swashbuckle.AspNetCore will be removed from the web API template). However, this new feature doesn't cover the full functionality offered by the previous approach for working with OpenAPI (Swashbuckle.AspNetCore or NSwag).
Why Swagger UI?
While alternatives like Redoc exist, Swagger UI stands out due to its widespread adoption, robust feature set, and developer-friendly interface.
API Proposal
Usage Examples
Risks
N/A
The text was updated successfully, but these errors were encountered: