I’ve been playing with the latest pre-release versions of SS and OpenAPI, specifically this commit:
For routes that return void (IReturnVoid), I still see a 200 Response class (with an empty body), instead of a 204, which is what I thought this commit added.
Do you have Config.Return204NoContentForEmptyResponse = true in the code? If this setting is set to true, can you provide a sample of service which shows response 200 in OpenAPI instead of 204?
I thought Return204NoContentForEmptyResponse was true by default, but I enabled it anyway,
My Service looks like:
[Route("/dhcp/servers/{ServerName}/scopes/{ScopeId}", "DELETE", Summary = "Deletes a DHCP scope.")]
public class DeleteDhcpScope : IReturnVoid
{
[ApiMember(ParameterType = "path", IsRequired = true, Description = "The FQDN of the DHCP server")]
public string ServerName { get; set; }
[ApiMember(ParameterType = "path", Description ="The Scope Id of the DHCP scope")]
public string ScopeId { get; set; }
}
One more variable ,f it matters, is that I’ve overridden the default swagger-ui index.html (just the index.html). I’m also using ReDoc, and the default 200 response class shows up there as well.
Things I’ve tried:
[Api(BodyParameter = GenerateBodyParameter.Never)] // doesn't help
[ApiResponse(204, "Option Deleted", ResponseType = typeof(void))] // creates an additional response, doesn't remove 200
[ApiResponse(204, "Option Deleted", ResponseType = typeof(void), IsDefaultResponse = true)] // also creates an additional response with HttpStatusCode set to "default", doesn't remove 200