-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Improve Results.Problem and Results.ValidationProblem APIs #36856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
BrennanConroy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a few smoke tests that the extensions are there and the new overloads work?
06bc3bd to
dc173b4
Compare
Co-authored-by: Stephen Halter <[email protected]>
|
"Hi captainsafia. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge. To learn more about how to prepare a servicing PR click here. |
|
Closing since we decided to target |
Re-opening since this was Servicing approved for RC2. See #36884 (comment). |
|
@dotnet/aspnet-build Can I get help merging? |
* Update WiX to signed build (#36865) - #12078 * Always download blazor-hotreload.js from app root (#36897) The middleware that we inject always listens to the root of the app. While this might not play very nicely if the app is running off a virtual path, listening to the root is what we do with the aspnet-browser-refresh.js script and we've had no issue reports with it thus far. Fixes #35555 * Improve Results.Problem and Results.ValidationProblem APIs (#36856) * [release/6.0-rc2] Update sdk to 6.0.100-rc.2.21470.55 (#36783) * Update sdk to 6.0.100-rc.2.21470.55 Co-authored-by: Will Godbe <[email protected]> Co-authored-by: Doug Bunting <[email protected]> Co-authored-by: Pranav K <[email protected]> Co-authored-by: Safia Abdalla <[email protected]> Co-authored-by: Stephen Halter <[email protected]> Co-authored-by: Will Godbe <[email protected]> Co-authored-by: Brennan <[email protected]>
Description
In .NET 6, we introduced new extension methods as shorthands for creating Results types from endpoint. However, due to an error, we missed adding a parameter to the
Results.ProblemandResults.ValidationProblemto align with theExtensionsproperty available in those types.As a result of this, customers are not able to return
ProblemDetailsorHttpValidationProblemDetailswith a configuredExtensionstype from their APIs.Customer Impact
Without this fix, customers are not able to return to return
ProblemDetailsobjectsThere are no desirable workarounds for this issue since the
Results.ProblemandResults.ValidationProblemprovide a public abstraction over a lot of currently internal functionality, like setting sensible defaults for the title and type of ProblemDetails.Regression?
Risk
Low risk because:
Resultsextension methods API.Verification
Packaging changes reviewed?
Background and Motivation
The
Results.ProblemandResults.Validationextension methods do not provide a way for users to customize theExtensionsproperty on the resultingProblemDetailspayload.To support these scenarios, we are adding the
extensionsparameter to the existing methods and adding new overloads that takes aProblemDetailsorHttpValidationProblemDetailsobject to provide further customizability for users.Proposed API
namespace Microsoft.AspNetCore.Http { public static class Results { public static IResult Problem( string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null, + IDictionary<string, object?>? extensions = null) { ... } + public static IResult Problem(ProblemDetails problemDetails) { ... } public static IResult ValidationProblem( IDictionary<string, string[]> errors, string? detail = null, string? instance = null, int? statusCode = null, string? title = null, string? type = null, + IDictionary<string, object?>? extensions = null) { ... } } }Usage Examples
Fixes #36848