'How to specify defaults for SwaggerResponse and SwaggerResponseExample?

Is there a way to specify the default response example in Swagger similar to the ProducesDefaultResponseType like this:

[ProducesDefaultResponseType(typeof(ProblemDetails))]

The Swagger attributes only seem to take the explicitly defined HTTP status codes:

[SwaggerResponse(HttpStatusCode.BadRequest, Type = typeof(ErrorExample), Description = "Error details")]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ErrorExample))]

Is there a way to get Swagger recognize defaults instead of copying the same information for every HTTP response code?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source