I have created an ASP.NET Core WEB API template project and targeting .NET 6.
I have the following controller code,
using System.Text.Json;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace abc.Controllers;
[Authorize]
[ApiController]
[Route("api/v{version:apiVersion}/customers/{customerId?}/something")]
public class XYZController : ControllerBase
{
[HttpPost]
public string PostAsync(int customerId)
{
return JsonSerializer.Serialize("Sample");
}
}
In the Swagger UI, I still see customerId as required,
How should I address this?
