Skip to content

Commit 7e5cf76

Browse files
authored
[Pre7] Remove comment about Minimal API's not supporting ProducesResponseType (#35752)
1 parent 8214e83 commit 7e5cf76

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed
Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
### Response description on ProducesResponseType for API controllers
1+
### Response description on `ProducesResponseType` for API controllers
22

3-
The [ProducesAttribute](/dotnet/api/microsoft.aspnetcore.mvc.producesattribute-1), [ProducesResponseTypeAttribute](/dotnet/api/microsoft.aspnetcore.mvc.producesresponsetypeattribute-1), and [ProducesDefaultResponseType](/dotnet/api/microsoft.aspnetcore.mvc.producesdefaultresponsetypeattribute) attributes now accept an optional string parameter, `Description`, that will set the description of the response. Here's an example:
3+
The <xref:Microsoft.AspNetCore.Mvc.ProducesAttribute>, <xref:Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute>, and <xref:Microsoft.AspNetCore.Mvc.ProducesDefaultResponseTypeAttribute> now accept an optional string parameter, `Description`, that sets the description of the response:
44

55
```csharp
66
[HttpGet(Name = "GetWeatherForecast")]
77
[ProducesResponseType<IEnumerable<WeatherForecast>>(StatusCodes.Status200OK,
8-
Description = "The weather forecast for the next 5 days.")]
8+
Description = "The weather forecast for the next 5 days.")]
99
public IEnumerable<WeatherForecast> Get()
1010
{
1111
```
1212

13-
And the generated OpenAPI:
13+
Generated OpenAPI data:
1414

1515
```json
16-
"responses": {
17-
"200": {
18-
"description": "The weather forecast for the next 5 days.",
19-
"content": {
16+
"responses": {
17+
"200": {
18+
"description": "The weather forecast for the next 5 days.",
19+
"content": {
2020
```
21-
[Minimal APIs](https://github.com/dotnet/aspnetcore/issues/58724) currently don't support `ProducesResponseType`.
2221

23-
[Community contribution](https://github.com/dotnet/aspnetcore/pull/58193) by [Sander ten Brinke](https://github.com/sander1095) 🙏
22+
This functionality is supported in both [API controllers](xref:web-api/index#apicontroller-attribute) and [Minimal APIs](xref:fundamentals/minimal-apis/overview). For Minimal APIs, the `Description` property is correctly set even when the attribute's type and the inferred return type aren't an exact match.
23+
24+
[Community contribution (`dotnet/aspnetcore` #58193)](https://github.com/dotnet/aspnetcore/pull/58193) by [Sander ten Brinke](https://github.com/sander1095).
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### Microsoft.AspNetCore.OpenApi added to the ASP.NET Core web API (Native AOT) template
22

3-
The **ASP.NET Core Web API (Native AOT)** project template (short name `webapiaot`) now includes support for OpenAPI document generation using the [`Microsoft.AspNetCore.OpenApi`](https://www.nuget.org/packages/Microsoft.AspNetCore.OpenApi) package by default. This support is disabled by using the `--no-openapi` flag when creating a new project.
3+
The **ASP.NET Core Web API (Native AOT)** project template (short name `webapiaot`) now includes support for OpenAPI document generation using the [`Microsoft.AspNetCore.OpenApi` package](https://www.nuget.org/packages/Microsoft.AspNetCore.OpenApi) by default. This support is disabled by using the `--no-openapi` flag when creating a new project.
44

5-
This was a community contribution by @sander1095. Thanks for this contribution!
5+
[Community contribution (`dotnet/aspnetcore` #60337)](https://github.com/dotnet/aspnetcore/pull/60337) by [Sander ten Brinke](https://github.com/sander1095).

0 commit comments

Comments
 (0)