Skip to content

Commit e2254ea

Browse files
Copilotwadepickett
andauthored
Freshness update: web-api-help-pages-using-swagger.md (#36787)
* Initial plan * Freshness update: web-api-help-pages-using-swagger.md Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> * Revise Swagger documentation for .NET 9 changes Updated the article to reflect changes in .NET 9 regarding OpenAPI support and the status of Swashbuckle. * Convert NOTE callout to introduction paragraphs Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wadepickett <10985336+wadepickett@users.noreply.github.com> Co-authored-by: Wade Pickett <wpickett@microsoft.com>
1 parent 87dab80 commit e2254ea

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

aspnetcore/tutorials/web-api-help-pages-using-swagger.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
---
22
title: ASP.NET Core web API documentation with Swagger / OpenAPI
3+
ai-usage: ai-assisted
34
author: RicoSuter
45
description: This tutorial provides a walkthrough of adding Swagger to generate documentation and help pages for a web API app.
56
ms.author: wpickett
67
ms.custom: mvc
78
monikerRange: ">= aspnetcore-3.1 <= aspnetcore-8.0"
8-
ms.date: 4/25/2024
9+
ms.date: 02/23/2026
910
uid: tutorials/web-api-help-pages-using-swagger
1011
---
1112
# ASP.NET Core web API documentation with Swagger / OpenAPI
@@ -14,6 +15,15 @@ uid: tutorials/web-api-help-pages-using-swagger
1415

1516
By [Rico Suter](https://blog.rsuter.com/)
1617

18+
This article covers using **Swagger** tooling — provided by the [Swashbuckle.AspNetCore](https://github.com/domaindrivendev/Swashbuckle.AspNetCore) and [NSwag](https://github.com/RicoSuter/NSwag) packages — to generate OpenAPI documentation and interactive help pages for ASP.NET Core web APIs.
19+
20+
In .NET 9 and later, ASP.NET Core includes built-in OpenAPI support that replaces Swashbuckle as the default. Swashbuckle is no longer included in project templates, but it remains available as a community package you can add manually.
21+
22+
* To understand the built‑in OpenAPI features, see <xref:fundamentals/openapi/overview?view=aspnetcore-9.0&preserve-view=true>.
23+
* To add Swagger UI for interactive exploration or local ad‑hoc testing alongside the built-in OpenAPI support, see <xref:fundamentals/openapi/using-openapi-documents#use-swagger-ui-for-local-ad-hoc-testing>.
24+
25+
The following instructions apply to projects using Swashbuckle or NSwag with ASP.NET Core 8.0 and earlier.
26+
1727
[Swagger](https://swagger.io/) ([OpenAPI](https://www.openapis.org/)) is a language-agnostic specification for describing REST APIs. It allows both computers and humans to understand the capabilities of a REST API without direct access to the source code. Its main goals are to:
1828

1929
* Minimize the amount of work needed to connect decoupled services.
@@ -147,12 +157,14 @@ In the preceding code, the `/weatherforecast` endpoint doesn't need authorizatio
147157
The following Curl passes a JWT token to test the Swagger UI endpoint:
148158

149159
```bash
150-
curl -i -H "Authorization: Bearer {token}" https://localhost:{port}/swagger/v1/swagger.json
160+
curl -i -H "Authorization: Bearer {TOKEN}" https://localhost:{PORT}/swagger/v1/swagger.json
151161
```
152162

163+
where the `{TOKEN}` placeholder is the JWT bearer token and the `{PORT}` placeholder is the port number.
164+
153165
For more information on testing with JWT tokens, see <xref:security/authentication/jwt>.
154166

155-
## Generate an XML documentation file at compile time.
167+
## Generate an XML documentation file at compile time
156168

157169
See [GenerateDocumentationFile](/dotnet/core/project-sdk/msbuild-props#generatedocumentationfile) for more information.
158170

0 commit comments

Comments
 (0)