-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WN9 ProblemValidation on route groups /a (#33330)
* WN9 ProblemValidation on route groups /a * WN9 ProblemValidation on route groups /a * fix * fix * fix * fix
- Loading branch information
1 parent
e48f231
commit 54ce817
Showing
2 changed files
with
11 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 8 additions & 5 deletions
13
aspnetcore/release-notes/aspnetcore-9/includes/prob_validation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
## Support calling `ProducesProblem` and `ProducesValidationProblem` on route groups | ||
<!-- Add this include to the OpenAPI section | ||
[!INCLUDE[](~/release-notes/aspnetcore-9/includes/prob_validation.md)] | ||
--> | ||
### Support calling `ProducesProblem` and `ProducesValidationProblem` on route groups | ||
|
||
The `ProducesProblem` and `ProducesValidationProblem` extension methods have been updated to support application on route groups, as in the sample below. These methods can be used to indicate that all endpoints in a route group can return `ProblemDetails` or `ValidationProblemDetails` responses for the purposes of OpenAPI metadata. | ||
The [ProducesProblem](/dotnet/api/microsoft.aspnetcore.http.openapiroutehandlerbuilderextensions.producesproblem) and [ProducesValidationProblem](/dotnet/api/microsoft.aspnetcore.http.openapiroutehandlerbuilderextensions.producesvalidationproblem) extension methods have been updated for route groups. These methods can be used to indicate that all endpoints in a route group can return `ProblemDetails` or `ValidationProblemDetails` responses for the purposes of OpenAPI metadata. | ||
|
||
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/ProducesProblem/Program.cs" id="snippet_1" ::: | ||
|
||
## `Problem` and `ValidationProblem` result types support construction with `IEnumerable<KeyValuePair<string, object?>>` values | ||
### `Problem` and `ValidationProblem` result types support construction with `IEnumerable<KeyValuePair<string, object?>>` values | ||
|
||
Prior to this preview, constructing `Problem` and `ValidationProblem` result types in minimal APIs required that the `errors` and `extensions` properties be initialized with an implementation of `IDictionary<string, object?>`. Starting in this release, these construction APIs support overloads that consume `IEnumerable<KeyValuePair<string, object?>>`. | ||
Prior to .NET 9, constructing [Problem](/dotnet/api/microsoft.aspnetcore.http.typedresults.problem) and [ValidationProblem](/dotnet/api/microsoft.aspnetcore.http.typedresults.validationproblem) result types in minimal APIs required that the `errors` and `extensions` properties be initialized with an implementation of `IDictionary<string, object?>`. In this release, these construction APIs support overloads that consume `IEnumerable<KeyValuePair<string, object?>>`. | ||
|
||
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/ProducesProblem/Program.cs" id="snippet_2" ::: | ||
|
||
Thanks to GitHub user "joegoldman2" for this contribution! | ||
Thanks to GitHub user [joegoldman2](https://github.com/joegoldman2) for this contribution! |