I have a WebAPI method with routing defined in an attribute, having one mandatory parameter and one optional:
[HttpGet]
[Route("api/ChargeCard/{cif}/{feeScheme=null}")]
[ResponseType(typeof(ChargeCardRoot))]
public IHttpActionResult Get(string cif, string feeScheme, ChargeCardRequestMode mode = ChargeCardRequestMode.Basic)
{
I also use Swashbuckle / Swagger to generate documentation. The problem is that Swagger always marks my optional parameter as required.
Changing optional parameter notation to:
[Route("api/ChargeCard/{cif}/{feeScheme?}")]
makes both parameters acting like they are required, it doesn't make Swagger to show it as optional either.
Is there a way to generate correct documentation for optional parameters with Swagger?