From 4ec13f4f1c683f0419d52d6be67e50e2c5a737e7 Mon Sep 17 00:00:00 2001 From: Marco Minerva Date: Wed, 14 Jan 2026 12:34:50 +0100 Subject: [PATCH] Deprecate ProducesDefaultProblem and update docs/deps Removed MinimalHelpers.OpenApi docs from README to focus on FluentValidation. Marked ProducesDefaultProblem as obsolete, recommending TinyHelpers.AspNetCore instead. Updated TinyHelpers.AspNetCore package to v4.1.15 in MinimalSample.csproj. --- README.md | 37 ------------------- samples/MinimalSample/MinimalSample.csproj | 2 +- .../RouteHandlerBuilderExtensions.cs | 1 + 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 143ceb6..6b54f44 100644 --- a/README.md +++ b/README.md @@ -119,43 +119,6 @@ app.Run(); > **Note** The `MapEndpoints` method is generated by the Source Generator. -## MinimalHelpers.OpenApi - -[![Nuget](https://img.shields.io/nuget/v/MinimalHelpers.OpenApi)](https://www.nuget.org/packages/MinimalHelpers.OpenApi) -[![Nuget](https://img.shields.io/nuget/dt/MinimalHelpers.OpenApi)](https://www.nuget.org/packages/MinimalHelpers.OpenApi) - -A library that provides OpenAPI helpers for Minimal API projects. - -### Installation - -The library is available on [NuGet](https://www.nuget.org/packages/MinimalHelpers.OpenApi). Search for *MinimalHelpers.OpenApi* in the **Package Manager GUI** or run the following command in the **.NET CLI**: - -```shell -dotnet add package MinimalHelpers.OpenApi -``` - -### Usage - - ***Extension methods for RouteHandlerBuilder*** - - Often, endpoints have multiple 4xx return values, each producing a `ProblemDetails` response: - - ```csharp - endpoints.MapGet("/api/people/{id:guid}", Get) - .ProducesProblem(StatusCodes.Status400BadRequest) - .ProducesProblem(StatusCodes.Status401Unauthorized) - .ProducesProblem(StatusCodes.Status403Forbidden) - .ProducesProblem(StatusCodes.Status404NotFound); - ``` - -To avoid multiple calls to `ProducesProblem`, use the `ProducesDefaultProblem` extension method provided by the library: - - ```csharp -endpoints.MapGet("/api/people/{id:guid}", Get) - .ProducesDefaultProblem(StatusCodes.Status400BadRequest, StatusCodes.Status401Unauthorized, - StatusCodes.Status403Forbidden, StatusCodes.Status404NotFound); - ``` - ## MinimalHelpers.FluentValidation [![Nuget](https://img.shields.io/nuget/v/MinimalHelpers.FluentValidation)](https://www.nuget.org/packages/MinimalHelpers.FluentValidation) diff --git a/samples/MinimalSample/MinimalSample.csproj b/samples/MinimalSample/MinimalSample.csproj index b45cdef..a1d8965 100644 --- a/samples/MinimalSample/MinimalSample.csproj +++ b/samples/MinimalSample/MinimalSample.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/MinimalHelpers.OpenApi/RouteHandlerBuilderExtensions.cs b/src/MinimalHelpers.OpenApi/RouteHandlerBuilderExtensions.cs index 2bb0c90..66f37a5 100644 --- a/src/MinimalHelpers.OpenApi/RouteHandlerBuilderExtensions.cs +++ b/src/MinimalHelpers.OpenApi/RouteHandlerBuilderExtensions.cs @@ -16,6 +16,7 @@ public static class RouteHandlerBuilderExtensions /// The . /// The list of status codes to be added as responses. /// The with the new status codes responses. + [Obsolete("This method will be removed in future versions. Use the ProducesDefaultProblem method that is available in the TinyHelpers.AspNetCoore library instead.")] public static RouteHandlerBuilder ProducesDefaultProblem(this RouteHandlerBuilder builder, params int[] statusCodes) { foreach (var statusCode in statusCodes)