MinimalApis.Extensions
MinimalApis.Extensions copied to clipboard
A set of extensions and helpers for working with ASP.NET Core Minimal APIs.
Right now, the filter scans all of the parameters to determine if the parameter type is validatable https://github.com/DamianEdwards/MinimalApis.Extensions/blob/115062c85d4e9b23292ba24bb4bfa49fe7ce4798/src/MinimalApis.Extensions/Filters/ValidationFilterRouteHandlerBuilderExtensions.cs#L187. I'd like to optionally short circuit this logic by specifying which types...
```csharp using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.AspNetCore.Mvc; namespace MinimalApis.Extensions.Filters; /// /// Defines an endpoint filter that modifies instances returned by route handler delegates /// using the . /// public class ProblemDetailsServiceEndpointFilter :...
E.g. `httpContext.Request.Accepts("application/json")`
Make it simple to do validation on multiple endpoints via an endpoint filter (new in ASP.NET Core 7).
Steps to reproduce. - `dotnet new webapi -minimal`. - Add reference to minimalapis.extensions. - Replace Program.cs with the following. ``` using Microsoft.AspNetCore.Http.HttpResults; using MinimalApis.Extensions.Binding; using System.ComponentModel.DataAnnotations; var builder = WebApplication.CreateBuilder(args);...
e.g. ``` c# app.MapPost("/todos", (FormData form) => { var todo = form.Value; // Do something with your todo here }); public record Todo(int Id, string Title, bool IsComplete); ``` Can...
Hi! every thing works fine, but swagger does not show parameters info when using mvc ModelBinder. my code: ```c# builder.Services.AddMvcCore(); ... app.MapGet("test", ( ModelBinder request)=> request.Model); public class GetOrderByIdRequest {...
From this [tweet thread](https://twitter.com/joaofbantunes/status/1486986901538103296). Parameters of a type marked with an `IBindProperties` interface will have its top-level members bound as if they were parameters on the route handler delegate, including...
Thanks to recent changes in rc.2 (dotnet/aspnetcore#36935), something like the following should now be possible: ``` c# app.MapPost("/todos", (Todo todo, TodoDb db) => { if (!todo.IsValid(out var errors)) { return...