GenHTTP icon indicating copy to clipboard operation
GenHTTP copied to clipboard

Add a framework to embrace MediatR

Open Kaliumhexacyanoferrat opened this issue 1 month ago • 3 comments

As a developer of a web application, I would like to simply re-use my MediatR handlers and forget about that complicated HTTP stuff, so that I can omit a lot of boilerplate code.

Example

public record GetUserQuery(int Id) : IRequest<User>;

var users = MediatRService.Create()
                          .Get<GetUserDetailsQuery>(":Id"); // automatically calls _mediator.Send(query)

var api = Layout.Create()
                .Add("users", users)
                .AddOpenApi();

Acceptance criteria

  • The feature is implemented as new framework
  • There is a new template project for this kind of projects
  • The feature is documented on the GenHTTP website
  • The feature is covered by acceptance tests

Kaliumhexacyanoferrat avatar Nov 27 '25 14:11 Kaliumhexacyanoferrat

Is this using the existing MediatR or create a framework for that?

MDA2AV avatar Nov 29 '25 12:11 MDA2AV

Existing MediatR - interesting part would be to find a clever mapping from queries to HTTP that works with the reflection module / the operation model.

Kaliumhexacyanoferrat avatar Nov 29 '25 13:11 Kaliumhexacyanoferrat

So the idea is to have a REPR pattern option? Because it is already possible to use MediatR normally as in ASP.NET

MDA2AV avatar Nov 29 '25 14:11 MDA2AV