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

ChangeAllResponsesByHttpStatusCode just for description doesn't work. #37

Open
NArnott opened this issue Jul 30, 2024 · 0 comments
Open

Comments

@NArnott
Copy link

NArnott commented Jul 30, 2024

I would like to be able to just enforce descriptions for status codes. e.g.:

ChangeAllResponsesByHttpStatusCode(StatusCodes.Status404NotFound, "BadRequest. One or more inputs are invalid.");

I'd assume this should be supported because responseExampleOption and responseExample default to none/null. However, this doesn't work.

First, it requires a generic argument even when no responseExample is passed, which makes no sense. But ok, I tried

ChangeAllResponsesByHttpStatusCode<object>(StatusCodes.Status404NotFound, "BadRequest. One or more inputs are invalid.");

But then I get this error:

InvalidOperationException: A suitable constructor for type 'Unchase.Swashbuckle.AspNetCore.Extensions.Filters.ChangeResponseByHttpStatusCodeDocumentFilter`1[System.Object]' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.

A new overload for ChangeAllResponsesByHttpStatusCode that just handles descriptions would be nice.

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

No branches or pull requests

1 participant