diff --git a/aspnetcore/release-notes/aspnetcore-9.0.md b/aspnetcore/release-notes/aspnetcore-9.0.md index d242fff2c94b..db22f8b3a893 100644 --- a/aspnetcore/release-notes/aspnetcore-9.0.md +++ b/aspnetcore/release-notes/aspnetcore-9.0.md @@ -45,14 +45,8 @@ This section describes new features for OpenAPI [!INCLUDE[](~/release-notes/aspnetcore-9/includes/openApi.md)] -[!INCLUDE[](~/release-notes/aspnetcore-9/includes/openAPI_completion.md)] - -[!INCLUDE[](~/release-notes/aspnetcore-9/includes/transformer-registration.md)] - [!INCLUDE[](~/release-notes/aspnetcore-9/includes/openapi-aot.md)] -[!INCLUDE[](~/release-notes/aspnetcore-9/includes/prob_validation.md)] - ## Authentication and authorization This section describes new features for authentication and authorization. diff --git a/aspnetcore/release-notes/aspnetcore-9/includes/openApi.md b/aspnetcore/release-notes/aspnetcore-9/includes/openApi.md index e487b4a439ce..a41d7c5582f5 100644 --- a/aspnetcore/release-notes/aspnetcore-9/includes/openApi.md +++ b/aspnetcore/release-notes/aspnetcore-9/includes/openApi.md @@ -1,6 +1,6 @@ ### Built-in support for OpenAPI document generation -The [OpenAPI specification](https://www.openapis.org/) is a standard for describing HTTP APIs. The standard allows developers to define the shape of APIs that can be plugged into client generators, server generators, testing tools, documentation, and more. In .NET 9 Preview, ASP.NET Core provides built-in support for generating OpenAPI documents representing controller-based or minimal APIs via the [Microsoft.AspNetCore.OpenApi](https://nuget.org/packages/Microsoft.AspNetCore.OpenApi) package. +The [OpenAPI specification](https://www.openapis.org/) is a standard for describing HTTP APIs. The standard allows developers to define the shape of APIs that can be plugged into client generators, server generators, testing tools, documentation, and more. In .NET 9, ASP.NET Core provides built-in support for generating OpenAPI documents representing controller-based or minimal APIs via the [Microsoft.AspNetCore.OpenApi](https://nuget.org/packages/Microsoft.AspNetCore.OpenApi) package. The following highlighted code calls: @@ -25,14 +25,14 @@ OpenAPI documents can also be generated at build-time by adding the [`Microsoft. dotnet add package Microsoft.Extensions.ApiDescription.Server --prerelease ``` -In the app's project file, add the following: +To modify the location of the emitted OpenAPI documents, set the target path in the OpenApiDocumentsDirectory property in the app's project file: -:::code language="xml" source="~/release-notes/aspnetcore-9/samples/OpenApiExample/OpenApiExample.csproj" range="9-12"::: +:::code language="xml" source="~/release-notes/aspnetcore-9/samples/OpenApiExample/OpenApiExample.csproj" range="9-11"::: Run `dotnet build` and inspect the generated JSON file in the project directory. ![OpenAPI document generation at build-time](~/release-notes/aspnetcore-9/_static/openapidoc2.png) -ASP.NET Core's built-in OpenAPI document generation provides support for various customizations and options. It provides document and operation transformers and has the ability to manage multiple OpenAPI documents for the same application. +ASP.NET Core's built-in OpenAPI document generation provides support for various customizations and options. It provides document, operation, and schema transformers and has the ability to manage multiple OpenAPI documents for the same application. To learn more about ASP.NET Core's new OpenAPI document capabilities, see [the new Microsoft.AspNetCore.OpenApi docs](https://aka.ms/aspnet/openapi). diff --git a/aspnetcore/release-notes/aspnetcore-9/includes/prob_validation.md b/aspnetcore/release-notes/aspnetcore-9/includes/prob_validation.md deleted file mode 100644 index 9dd411782720..000000000000 --- a/aspnetcore/release-notes/aspnetcore-9/includes/prob_validation.md +++ /dev/null @@ -1,13 +0,0 @@ -### Support calling `ProducesProblem` and `ProducesValidationProblem` on route groups - -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>` values - -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`. In this release, these construction APIs support overloads that consume `IEnumerable>`. - -:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/ProducesProblem/Program.cs" id="snippet_2" ::: - -Thanks to GitHub user [joegoldman2](https://github.com/joegoldman2) for this contribution! diff --git a/aspnetcore/release-notes/aspnetcore-9/includes/produces-problem.md b/aspnetcore/release-notes/aspnetcore-9/includes/produces-problem.md index 7eeaf2a1ca20..376a55181997 100644 --- a/aspnetcore/release-notes/aspnetcore-9/includes/produces-problem.md +++ b/aspnetcore/release-notes/aspnetcore-9/includes/produces-problem.md @@ -15,3 +15,11 @@ app.Run(); record Todo(int Id, string Title, boolean IsCompleted); ``` + +### `Problem` and `ValidationProblem` result types support construction with `IEnumerable>` values + +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`. In this release, these construction APIs support overloads that consume `IEnumerable>`. + +:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/ProducesProblem/Program.cs" id="snippet_2" ::: + +Thanks to GitHub user [joegoldman2](https://github.com/joegoldman2) for this contribution! diff --git a/aspnetcore/release-notes/aspnetcore-9/includes/transformer-registration.md b/aspnetcore/release-notes/aspnetcore-9/includes/transformer-registration.md deleted file mode 100644 index 5b06ecc63fbb..000000000000 --- a/aspnetcore/release-notes/aspnetcore-9/includes/transformer-registration.md +++ /dev/null @@ -1,29 +0,0 @@ -### Improvements to transformer registration APIs in Microsoft.AspNetCore.OpenApi - -OpenAPI transformers support modifying the OpenAPI document, operations within the document, or schemas associated with types in the API. The APIs for registering transformers on an OpenAPI document provide a variety of options for registering transformers. - -Previously, the following APIs were available for registering transformers: - -```csharp -OpenApiOptions AddDocumentTransformer(Func transformer) -OpenApiOptions AddDocumentTransformer(IOpenApiDocumentTransformer transformer) -OpenApiOptions AddDocumentTransformer() -OpenApiOptions UseSchemaTransformer(Func) -OpenApiOptions AddOperationTransformer(Func) -``` - -The new API set is as follows: - -```csharp -OpenApiOptions AddDocumentTransformer(Func transformer) -OpenApiOptions AddDocumentTransformer(IOpenApiDocumentTransformer transformer) -OpenApiOptions AddDocumentTransformer() - -OpenApiOptions AddSchemaTransformer(Func transformer) -OpenApiOptions AddSchemaTransformer(IOpenApiSchemaTransformer transformer) -OpenApiOptions AddSchemaTransformer() - -OpenApiOptions AddOperationTransformer(Func transformer) -OpenApiOptions AddOperationTransformer(IOpenApiOperationTransformer transformer) -OpenApiOptions AddOperationTransformer() -``` diff --git a/aspnetcore/release-notes/aspnetcore-9/samples/OpenApiExample/OpenApiExample.csproj b/aspnetcore/release-notes/aspnetcore-9/samples/OpenApiExample/OpenApiExample.csproj index 8f1ac0af2547..fc9b9eeaa7f0 100644 --- a/aspnetcore/release-notes/aspnetcore-9/samples/OpenApiExample/OpenApiExample.csproj +++ b/aspnetcore/release-notes/aspnetcore-9/samples/OpenApiExample/OpenApiExample.csproj @@ -8,9 +8,8 @@ $(MSBuildProjectDirectory) - true - +