Skip to content
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

Add helper method for bulk Produces metadata in MinimalHelpers.OpenApi #64

Closed
marcominerva opened this issue Oct 18, 2024 · 0 comments · Fixed by #65
Closed

Add helper method for bulk Produces metadata in MinimalHelpers.OpenApi #64

marcominerva opened this issue Oct 18, 2024 · 0 comments · Fixed by #65
Assignees
Labels
enhancement New feature or request

Comments

@marcominerva
Copy link
Owner

marcominerva commented Oct 18, 2024

Often we have endpoints with multiple 4xx return values, each of which produces a ProblemDetails response:

app.MapPost("...", () =>{ })
    .ProducesProblem(StatusCodes.401Unauthorized)
    .ProducesProblem(StatusCodes.403Forbidden)
    .ProducesProblem(StatusCodes.404NotFound)
    .ProducesProblem(StatusCodes.409Conflict)

It would be helpful to have a single method, let's say ProducesDefaultProblem, that's takes a list of status codes and automatically call ProducesProblem methods for each one.

@marcominerva marcominerva added the enhancement New feature or request label Oct 18, 2024
@marcominerva marcominerva self-assigned this Oct 18, 2024
marcominerva added a commit that referenced this issue Oct 18, 2024
Introduce a new extension method `ProducesDefaultProblem` for the
`RouteHandlerBuilder` class to simplify defining common error
responses.

Enhance `README.md` with
documentation and examples for the new method.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant