Convert all web API controllers to TypedResults and add Problem Details middleware#8
Draft
Convert all web API controllers to TypedResults and add Problem Details middleware#8
Conversation
… Details middleware Agent-Logs-Url: https://github.com/f2calv/SmartHaus/sessions/12b9568f-44b8-411d-87dd-236a04502ce8 Co-authored-by: f2calv <16097639+f2calv@users.noreply.github.com>
Agent-Logs-Url: https://github.com/f2calv/SmartHaus/sessions/12b9568f-44b8-411d-87dd-236a04502ce8 Co-authored-by: f2calv <16097639+f2calv@users.noreply.github.com>
f2calv
requested changes
May 4, 2026
|
|
||
| /// <inheritdoc cref="BuderusQueryService.GetEvents"/> | ||
| [HttpGet("{id}")] | ||
| [ProducesResponseType(StatusCodes.Status200OK)] |
Owner
There was a problem hiding this comment.
Shouldn't TypedResults mean these attributes no longer need to be present?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Convert all controller actions from
IActionResultto strongly-typedTypedResultsreturn types per ASP.NET Core 10 guidance, and wire up RFC 7807 Problem Details for automatic error response formatting.Problem Details middleware
AddProblemDetails()+UseExceptionHandler()+UseStatusCodePages()inProgram.csTypedResults conversion (17 controllers)
IActionResultreturns replaced with concrete types:Ok<T>,NotFound,BadRequest<string>,Accepted<T>,Results<T1, T2>,FileContentHttpResultOk()→TypedResults.Ok(),NotFound()→TypedResults.NotFound(), etc.global using Microsoft.AspNetCore.Http.HttpResults;to all API projectGlobalUsings.csfilesExample
This gives compile-time guarantees on response types and enables better OpenAPI schema generation without relying on
[ProducesResponseType]attributes alone.