dotnet / dotnet/aspnetcore

Extend Results in TypedResults to support more than 6 types

Open
#61,706 4 comments 4 reactions 0 assignees View on GitHub
area-minimal
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

## Summary

Currently the Results type has a maximum of 6 generic parameters. This limits the number of strongly typed results that can be returned by a Web API. This could be extended to a larger number to support use cases with a larger number of types returned.

## Motivation and goals

I find it is quite common to return quite large numbers of TypedResults.

For example, on the most recent case, I need 7 result types:
`Ok`, `BadRequest`, `NotFound`, `Conflict`, `ForbidHttpResult`, `InternalServerError`, `StatusCodeHttpResult`.

I also sometimes find myself returning multiple generic TypedResults to represent different types of responses. For example, `Ok`, `Ok`, `Ok`, when combined with typical error cases, this frequently exceeds the current limit of 6.

I would suggest that is would be useful if the current limit of 6 were to be extended.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.