CarterCommunity / Carter

Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
MIT License
2.1k stars 175 forks source link

Accept RouteMetaData instance #143

Closed colinbate closed 2 years ago

colinbate commented 5 years ago

Thanks for the OpenAPI work, it would be nice if the route could accept an instance of RouteMetaData as an alternative to a type name. I'm not too concerned about how that instance would get passed but I'd like to avoid the creation of new classes for each route just to document it. Kind of defeats the purpose of using Carter in the first place in my opinion.

jchannon commented 5 years ago

Like Get(“/home”, new RouteMetaData{Responses = new []{..}}, async context => ....

colinbate commented 5 years ago

Yes, something like that...

I was imagining pairing it with some sort of helper function or reusable class:

Get("/home", Describe<Input, Output>("My home endpoint", "tag"), async ctx => {});
heerup commented 4 years ago

234 I gave it a shot.

jchannon commented 2 years ago

Carter 6 will use .NET 6 for OpenApi