Skip to content

feat(mediator): advertise standard ProblemDetails responses - #799

Merged
AndreaCuneo merged 3 commits into
masterfrom
copilot/mediator-framework-next-task
Jul 26, 2026
Merged

feat(mediator): advertise standard ProblemDetails responses#799
AndreaCuneo merged 3 commits into
masterfrom
copilot/mediator-framework-next-task

Conversation

Copilot AI commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Generated mediator endpoints lacked OpenAPI declarations for standard 400/403/500 error responses.

  • Endpoint metadata

    • Advertise ProblemDetails with application/problem+json on unary, command, upload, and download endpoints.
    • Omit 403 for anonymous endpoints.
    • Avoid duplicate declarations when custom success/null status codes collide.
  • Error responses

    • Return ProblemDetails for empty MessagePack bodies.
    • Return ProblemDetails for invalid multipart uploads.
  • Documentation and coverage

    • Document HTTP-to-gRPC error status mappings.
    • Add generator coverage for anonymous endpoints and status collisions.
.Produces<ProblemDetails>(400, "application/problem+json")
.Produces<ProblemDetails>(403, "application/problem+json")
.Produces<ProblemDetails>(500, "application/problem+json")

Copilot AI and others added 2 commits July 26, 2026 18:02
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 26, 2026 18:11
@AndreaCuneo
AndreaCuneo marked this pull request as ready for review July 26, 2026 18:12
@AndreaCuneo
AndreaCuneo requested a review from a team as a code owner July 26, 2026 18:12
Copilot AI review requested due to automatic review settings July 26, 2026 18:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Mediator Minimal API generator to consistently advertise standard ProblemDetails error responses (400/403/500) in generated OpenAPI metadata, aligning endpoint documentation with runtime behavior and improving contract clarity for clients.

Changes:

  • Emit .Produces<ProblemDetails>(400/403/500, "application/problem+json") metadata for generated endpoints, skipping 403 for AllowAnonymous.
  • Return ProblemDetails results for empty MessagePack request bodies and invalid multipart uploads.
  • Add/extend documentation and generator tests around the new standard error responses and collision handling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/Ark.Tools.MediatorFramework.Tests/GeneratorSnapshotTests.cs Adds a generator test ensuring standard ProblemDetails responses are emitted without duplicate status declarations.
src/mediator-framework/Ark.Tools.MediatorFramework.MinimalApi.Generators/MinimalApiEndpointGenerator.cs Adds ProblemMetadata(...) emission across endpoint shapes and switches some bad-request paths to Results.Problem(...).
docs/mediator-framework/design.md Documents HTTP ProblemDetails ↔ gRPC canonical status code mappings (but currently breaks an existing markdown table).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/mediator-framework/design.md
Comment thread tests/Ark.Tools.MediatorFramework.Tests/GeneratorSnapshotTests.cs
Co-authored-by: AndreaCuneo <5227688+AndreaCuneo@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 26, 2026 18:20
Copilot AI requested a review from AndreaCuneo July 26, 2026 18:21
@AndreaCuneo
AndreaCuneo merged commit 22ac7ad into master Jul 26, 2026
7 checks passed
@AndreaCuneo
AndreaCuneo deleted the copilot/mediator-framework-next-task branch July 26, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants