|
1 | 1 | # OpenAPI
|
2 | 2 |
|
3 |
| -JsonApiDotNetCore provides an extension package that enables you to produce an [OpenAPI specification](https://swagger.io/specification/) for your JSON:API endpoints. This can be used to generate a [documentation website](https://swagger.io/tools/swagger-ui/) or to generate [client libraries](https://openapi-generator.tech/docs/generators/) in various languages. The package provides an integration with [Swashbuckle](https://github.com/domaindrivendev/Swashbuckle.AspNetCore). |
| 3 | +JsonApiDotNetCore provides an extension package that enables you to produce an [OpenAPI specification](https://swagger.io/specification/) for your JSON:API endpoints. |
| 4 | +This can be used to generate a [documentation website](https://swagger.io/tools/swagger-ui/) or to generate [client libraries](https://openapi-generator.tech/docs/generators/) in various languages. |
| 5 | +The package provides an integration with [Swashbuckle](https://github.com/domaindrivendev/Swashbuckle.AspNetCore). |
4 | 6 |
|
5 | 7 |
|
6 | 8 | ## Getting started
|
@@ -35,10 +37,29 @@ By default, the OpenAPI specification will be available at `http://localhost:<po
|
35 | 37 |
|
36 | 38 | ## Documentation
|
37 | 39 |
|
38 |
| -Swashbuckle also ships with [SwaggerUI](https://swagger.io/tools/swagger-ui/), which enables to visualize and interact with the API endpoints through a web page. This can be enabled by installing the `Swashbuckle.AspNetCore.SwaggerUI` NuGet package and adding the following to your `Program.cs` file: |
| 40 | +### SwaggerUI |
| 41 | +
|
| 42 | +Swashbuckle also ships with [SwaggerUI](https://swagger.io/tools/swagger-ui/), which enables to visualize and interact with the API endpoints through a web page. |
| 43 | +This can be enabled by installing the `Swashbuckle.AspNetCore.SwaggerUI` NuGet package and adding the following to your `Program.cs` file: |
39 | 44 |
|
40 | 45 | ```c#
|
41 | 46 | app.UseSwaggerUI();
|
42 | 47 | ```
|
43 | 48 |
|
44 | 49 | By default, SwaggerUI will be available at `http://localhost:<port>/swagger`.
|
| 50 | + |
| 51 | +### Triple-slash comments |
| 52 | + |
| 53 | +Documentation for JSON:API endpoints is provided out of the box, which shows in SwaggerUI and through IDE IntelliSense in auto-generated clients. |
| 54 | +To also get documentation for your resource classes and their properties, add the following to your project file. |
| 55 | +The `NoWarn` line is optional, which suppresses build warnings for undocumented types and members. |
| 56 | + |
| 57 | +```xml |
| 58 | + <PropertyGroup> |
| 59 | + <GenerateDocumentationFile>True</GenerateDocumentationFile> |
| 60 | + <NoWarn>$(NoWarn);1591</NoWarn> |
| 61 | + </PropertyGroup> |
| 62 | +``` |
| 63 | + |
| 64 | +You can combine this with the documentation that Swagger itself supports, by enabling it as described [here](https://github.com/domaindrivendev/Swashbuckle.AspNetCore#include-descriptions-from-xml-comments). |
| 65 | +This adds documentation for additional types, such as triple-slash comments on enums used in your resource models. |
0 commit comments