Skip to content

Commit 0d91dad

Browse files
authored
Surface controller attribute requirement
1 parent bf56fff commit 0d91dad

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

aspnetcore/fundamentals/openapi/include-metadata.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Include OpenAPI metadata in an ASP.NET Core app
33
author: captainsafia
4-
description: Learn how to add OpenAPI metadata in an ASP.NET Core app
4+
description: Learn how to add OpenAPI metadata in an ASP.NET Core app.
55
ms.author: safia
66
monikerRange: '>= aspnetcore-9.0'
77
ms.custom: mvc
@@ -10,15 +10,19 @@ uid: fundamentals/openapi/include-metadata
1010
---
1111
# Include OpenAPI metadata in an ASP.NET Core app
1212

13+
This article explains how to add OpenAPI metadata in an ASP.NET Core app.
14+
1315
## Include OpenAPI metadata for endpoints
1416

1517
:::moniker range=">= aspnetcore-10.0"
1618

1719
ASP.NET collects metadata from the web app's endpoints and uses it to generate an OpenAPI document.
18-
In controller-based apps, metadata is collected from attributes like [`[EndpointDescription]`](xref:Microsoft.AspNetCore.Http.EndpointDescriptionAttribute), [`[HttpPost]`](xref:Microsoft.AspNetCore.Mvc.HttpPostAttribute),
19-
and [`[Produces]`](xref:Microsoft.AspNetCore.Mvc.ProducesAttribute).
20-
In minimal APIs, metadata can be collected from attributes, but may also be set by using extension methods
21-
and other strategies, such as returning <xref:Microsoft.AspNetCore.Http.TypedResults> from route handlers.
20+
21+
In controller-based apps, metadata is collected from attributes such as [`[EndpointDescription]`](xref:Microsoft.AspNetCore.Http.EndpointDescriptionAttribute), [`[HttpPost]`](xref:Microsoft.AspNetCore.Mvc.HttpPostAttribute),
22+
and [`[Produces]`](xref:Microsoft.AspNetCore.Mvc.ProducesAttribute) when the controller has the [`[ApiController]` attribute](xref:Microsoft.AspNetCore.Mvc.ApiControllerAttribute).
23+
24+
In minimal APIs, metadata can be collected from attributes but may also be set by using extension methods and other strategies, such as returning <xref:Microsoft.AspNetCore.Http.TypedResults> from route handlers.
25+
2226
The following table provides an overview of the metadata collected and the strategies for setting it.
2327

2428
| Metadata | Attribute | Extension method | Other strategies |

0 commit comments

Comments
 (0)