I have an ASP.NET Core Service that produces both JSON and XML responses. However, I like to restrict the accepted Media Type for only one action, so Swagger can only list a
You can use the annotations Consumes and Produces. These are also picked up by Swashbuckle. Like so:
[HttpGet] [Consumes("application/xml")] [Produces("application/xml")] public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; }