Skip to content

Commit 3cd06be

Browse files
authored
Guidance on launching the tools (#35386)
1 parent b74c593 commit 3cd06be

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

aspnetcore/fundamentals/openapi/using-openapi-documents.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ The `Swashbuckle.AspNetCore.SwaggerUi` package provides a bundle of Swagger UI's
2525

2626
As a security best practice on limiting information disclosure, ***OpenAPI user interfaces (Swagger UI, ReDoc, Scalar) should only be enabled in development environments.*** For example, see [Swagger OAuth 2.0 configuration](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/).
2727

28+
Launch the app and navigate to `https://localhost:<port>/swagger` to view the Swagger UI.
29+
30+
To automatically launch the app at the Swagger UI URL using the `https` profile of `Properties/launchSettings.json`:
31+
32+
* Confirm that `launchBrowser` is enabled (`true`).
33+
* Set the `launchUrl` to `swagger`.
34+
35+
```json
36+
"launchBrowser": true,
37+
"launchUrl": "swagger",
38+
```
39+
2840
## Use Scalar for interactive API documentation
2941

3042
[Scalar](https://scalar.com/) is an open-source interactive document UI for OpenAPI. Scalar can integrate with the OpenAPI endpoint provided by ASP.NET Core. To configure Scalar, install the `Scalar.AspNetCore` package.
@@ -33,6 +45,16 @@ As a security best practice on limiting information disclosure, ***OpenAPI user
3345

3446
Launch the app and navigate to `https://localhost:<port>/scalar/v1` to view the Scalar UI.
3547

48+
To automatically launch the app at the Scalar UI URL using the `https` profile of `Properties/launchSettings.json`:
49+
50+
* Confirm that `launchBrowser` is enabled (`true`).
51+
* Set the `launchUrl` to `scalar/v1`.
52+
53+
```json
54+
"launchBrowser": true,
55+
"launchUrl": "scalar/v1",
56+
```
57+
3658
## Lint generated OpenAPI documents with Spectral
3759

3860
[Spectral](https://stoplight.io/open-source/spectral) is an open-source OpenAPI document linter. Spectral can be incorporated into an app build to verify the quality of generated OpenAPI documents. Install Spectral according to the [package installation directions](https://github.com/stoplightio/spectral#-installation).

0 commit comments

Comments
 (0)