public IEnumerable <ApiResponseType> Map(MethodInfo methodInfo) { if (methodInfo == null) { throw new ArgumentNullException(nameof(methodInfo)); } var attributes = methodInfo.GetCustomAttributes(typeof(SwaggerResponseAttribute), false); foreach (SwaggerResponseAttribute attribute in attributes) { yield return(_responseFactory.CreateResponse(attribute.StatusCode, attribute.Type)); } }
public IEnumerable <ApiResponseType> Map(MethodInfo methodInfo) { if (methodInfo == null) { throw new ArgumentNullException(nameof(methodInfo)); } var attributes = methodInfo.GetCustomAttributes(typeof(ProducesResponseTypeAttribute), false); foreach (var attribute in attributes) { if (attribute.GetType() != typeof(ProducesResponseTypeAttribute)) { continue; } var typedAttribute = attribute as ProducesResponseTypeAttribute; yield return(_responseFactory.CreateResponse(typedAttribute.StatusCode, typedAttribute.Type)); } }