Swashbuckle.AspNetCore
Swashbuckle.AspNetCore copied to clipboard
[Feature req] Force different parameter type specification due to custom model binder
I have and endpoint which uses a custom model binder that decrypts a string to an integer id (decryption use authenticated user session data) for a given parameter:
/// <summary>
/// Retrieve an image with given id
/// </summary>
/// <param name="imageId">string identifier of the image to be retrieved</param>
/// <returns></returns>
[HttpGet]
[Route("get/{imageId}")]
public IActionResult Get(
[FromRoute,
ModelBinder(BinderType = typeof(MyCustomModelBinder))] int imageId)
{
// here:
// -before this method execution, MyCustomModelBinder decrypt string imagedId (using user session data) and produces a valid int imageId
// -then this metod retrieve image with given id imageId and returns image data
}
Even if imageId
parameter is defined as int
, the REST call should use a string
.
Example:
GET https://localhost/images/get/BQwlwDLHGXoUvich4fxhzw%3D%3D
A new feature that for a given parameter allow to force Swashbuckle to use a specific type in swagger document (despite its declaring type) will be very useful for this scenario.
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.
This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.
This issue was closed because it has been inactive for 14 days since being marked as stale.