ardalis / ardalis/Result

ProblemDetails.Status not populated on error responses

Open
#253 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1k
Forks
127
PR merge metrics
No merged PRs in 30d

Description

The `ProblemDetails` bodies produced by the result→HTTP conversions omit the `Status` member for several statuses, so the JSON body's `status` is `null` even though the HTTP status code on the response is correct. It is also applied inconsistently — some builders set it, others don't — and RFC 7807 §3.1 says the `status` member SHOULD be present and match the actual HTTP status code.

| Result status | Minimal API (`MinimalApiResultExtensions`) | MVC (`ResultStatusMap`) |
|---|---|---|
| 422 Error / 404 NotFound / 409 Conflict | missing | missing |
| 500 CriticalError / 503 Unavailable | set | missing |
| 403 Forbidden / 401 Unauthorized | set | n/a (status code only, no body) |

This matters to clients that read `status` off the parsed body (e.g. generated clients that throw the parsed `ProblemDetails`), where the HTTP status code is otherwise not readily available.

Happy to open a PR.

Contributor guide

Open the contributing guide

Research direction

Start by locating MinimalApiResultExtensions and ResultStatusMap, then trace the result-to-HTTP conversions for the statuses listed in the issue. Verify each produced ProblemDetails JSON body has a status matching the HTTP response code, including 422, 404, 409, 500, and 503.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.