IResult endpoint configuration/overloads? #99
Replies: 1 comment 1 reply
|
@WorldMaker Hello, thank you for your input. Here are some of my thoughts. Conceptually The concept of At the same time, being functional has never been Oxpecker's goal. It's main goal was to take successful and well-known Giraffe's API and fix its main issues and pain points, providing as easy to use API as possible. Another Oxpecker's goal is to be one of the fastest .NET web frameworks (at the very least, faster than Minimal API), and using OpenAPI schema is the only feature why I would want to use
You can still use typed results everywhere in your code and use either
TBH, |
Uh oh!
There was an error while loading. Please reload this page.
Hello, I used Oxpecker for the first time a bit okay for a test project. I've been thinking about the API versus raw ASP.NET Minimal API and feel like there might be an efficiency gain using
IResultmore directly as an explicit output type in Endpoint configuration. (More specifically thatTask<IResult>is a potentially more useful return type for an endpoint than unitTask.)A lot of the current handlers and how much sample code uses manual
ctx.Writecalls remind of something I feel that I see a lot in regular ASP.NET binding, like a fallback to imperative patterns in the middle of something that could be purely function. But in ASP.NET Minimal API when you focus in on returningIResultorIResult<'T>everywhere and especially in using the TypedResult family things like OpenAPI/Swagger documentation starts to be a whole lot more self-documenting and endpoints start feeling a lot more like pure functions: take in an input and return an output.IResultand its family is a lot of complex machinery, but embracing it offers functional programming options that I think make for easier to unit test endpoints.(The possible height of my functional programming in Minimal API so far was building an
IResultwrapper for LanguageExtAff<T>to be a tiny imperative shell for a larger functional core in C#. Not directly applicable, but perhaps and interesting illustration both why ASP.NET'sIResultfamily seems so complex and also what great functional programming powers you can build with it.)Just thought I'd throw the idea at the wall, see if it sticks or resonates.
All reactions