RobinMeow / CommunityCookbook

CommunityCookbook
MIT License
0 stars 0 forks source link

use modern API code #120

Closed RobinMeow closed 5 months ago

RobinMeow commented 5 months ago

I think TypedResult is the thing im looking for.

The current implementation has alot of boilerplate code and was written for api-generaotor-cli which is no longer being used.

RobinMeow commented 5 months ago

https://learn.microsoft.com/en-us/aspnet/core/web-api/action-return-types?view=aspnetcore-8.0

The static TypedResults class returns the concrete IResult implementation that allows using IResult as return type. The usage of the concrete IResult implementation offers the following benefit over the IResult type:

All the [ProducesResponseType] attributes can be excluded, since the HttpResult implementation contributes automatically to the endpoint metadata.