Skip to content

ChangeAllResponsesByHttpStatusCode just for description doesn't work. #37

@NArnott

Description

@NArnott

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions