You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft.AspNetCore.OpenApi is a NuGet package that provides built-in support for generating OpenAPI documents from minimal or controller-based APIs in ASP.NET Core.
4
+
5
+
## Key Features
6
+
7
+
* Supports viewing generated OpenAPI documents at runtime via a parameterized endpoint (`/openapi/{documentName}.json`)
8
+
* Supports generating an OpenAPI document at build-time
9
+
* Supports customizing the generated document via document transformers
10
+
11
+
## How to Use
12
+
13
+
To start using Microsoft.AspNetCore.OpenApi in your ASP.NET Core application, follow these steps:
14
+
15
+
### Installation
16
+
17
+
```sh
18
+
dotnet add package Microsoft.AspNetCore.OpenApi
19
+
```
20
+
21
+
### Configuration
22
+
23
+
In your Program.cs file, register the services provided by this package in the DI container and map the provided OpenAPI document endpoint in the application.
24
+
25
+
```C#
26
+
varbuilder=WebApplication.CreateBuilder();
27
+
28
+
// Registers the required services
29
+
builder.Services.AddOpenApi();
30
+
31
+
varapp=builder.Build();
32
+
33
+
// Adds the /openapi/{documentName}.json endpoint to the application
34
+
app.MapOpenApi();
35
+
36
+
app.Run();
37
+
```
38
+
39
+
For more information on configuring and using Microsoft.AspNetCore.OpenApi, refer to the [official documentation](https://learn.microsoft.com/aspnet/core/fundamentals/minimal-apis/openapi).
40
+
41
+
## Main Types
42
+
43
+
<!-- The main types provided in this library -->
44
+
45
+
The main types provided by this library are:
46
+
47
+
*`OpenApiOptions`: Options for configuring OpenAPI document generation.
48
+
*`IDocumentTransformer`: Transformer that modifies the OpenAPI document generated by the library.
49
+
50
+
## Feedback & Contributing
51
+
52
+
<!-- How to provide feedback on this package and contribute to it -->
53
+
54
+
Microsoft.AspNetCore.OpenApi is released as open-source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/aspnetcore).
0 commit comments