-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
Milestone
Description
Background and Motivation
Now that RFC 9110 - HTTP Semantics is official, with the inclusion of the 422 Unprocessable Content status code, I'd like to propose the following changes to ASP.NET Core APIs.
Existing (shipped) members containing UnprocessableEntity is kept, but will simply forward to its UnprocessableContent counterpart.
Proposed API
namespace Microsoft.AspNetCore.Http;
public static class StatusCodes
{
+ public const int Status422UnprocessableContent = 422;
}
public static partial class Results
{
+ public static IResult UnprocessableContent(object? error = null) { throw null; }
}
public static class TypedResults {
- public static UnprocessableEntity UnprocessableEntity();
+ public static UnprocessableContent UnprocessableContent();
- public static UnprocessableEntity<TValue> UnprocessableEntity<TValue>(TValue? error) { throw null; }
+ public static UnprocessableContent<TValue> UnprocessableContent<TValue>(TValue? error) { throw null; }
}
namespace Microsoft.AspNetCore.Http.HttpResults;
-public sealed class UnprocessableEntity : IResult, IEndpointMetadataProvider { }
+public sealed class UnprocessableContent : IResult, IEndpointMetadataProvider { }
-public sealed class UnprocessableEntity<TValue> : IResult, IEndpointMetadataProvider { }
+public sealed class UnprocessableContent<TValue> : IResult, IEndpointMetadataProvider { }Alternative Designs
Keeping the old name as-is? Should the existing UnprocessableEntity APIs be marked as [Obsolete]?
Risks
I'm not sure there are any.
aayjaychan
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc