As per my understanding of the Swagger Specification, it's possible to mark a parameter as obsolete:
Deprecated Parameters
Use
deprecated: true
to mark a parameter as deprecated.- in: query name: format required: true schema: type: string enum: [json, xml, yaml] deprecated: true description: Deprecated, use the appropriate `Accept` header instead.```
How can I have Swashbuckle generate this for a parameter?
Why?
I have a controller method something like the following:
[HttpGet]
public async Task<IActionResult> Execute(bool? someName)
{
}
And I want to change the querystring parameter name while temporarily remaining backwards compatible, so I want to do something like:
[HttpGet]
public async Task<IActionResult> Execute([Obsolete("Use someNewName instead.")] bool? someName, bool? someNewName)
{
someNewName = someNewName ?? someName;
}
However, Obsolete
cannot be applied to a parameter. I expected that Swashbuckle.AspNetCore.Annotations
might be a place to find this kind of functionality, but it doesn't seem to have it.