/// <summary>
        /// Defines a filter for DefaultResponseType that the controller action should have an attribute of type <typeparamref name="TAttribute"/> in order to be added to the api description.
        /// </summary>
        /// <typeparam name="TAttribute">Type of the attribute, with a constraint on type Attribute</typeparam>
        /// <param name="defaultResponseType">The original default response type.</param>
        /// <returns>The original default response type with an added filter.</returns>
        public static DefaultResponseType WhenHasAttribute <TAttribute>(this DefaultResponseType defaultResponseType)
            where TAttribute : Attribute
        {
            defaultResponseType.When(apiDesc => apiDesc.ActionDescriptor.HasCustomControllerActionAttribute <TAttribute>());

            return(defaultResponseType);
        }
        /// <summary>
        /// Defines a filter for DefaultResponseType that a route parameter has to be present in order to be added to the api description.
        /// </summary>
        /// <param name="defaultResponseType">The original default response type.</param>
        /// <param name="paramNameEquals">The name of the route parameter should equal the provided value. Comparison is case insensitive. Cannot be used in combination with <paramref name="paramNameContains"/>.</param>
        /// <param name="paramNameContains">The name of the route parameter should contain the provided value. Comparison is case insensitive. Cannot be used in combination with <paramref name="paramNameEquals"/>.</param>
        /// <returns>The original default response type with an added filter.</returns>
        /// <exception cref="ArgumentException">Thrown when both the <paramref name="paramNameEquals"/> and <paramref name="paramNameContains"/> are provided.</exception>
        public static DefaultResponseType WhenHasRouteParameter(this DefaultResponseType defaultResponseType, string paramNameEquals = null, string paramNameContains = null)
        {
            if (paramNameContains != null && paramNameEquals != null)
            {
                throw new ArgumentException($"Parameters {nameof(paramNameContains)} and {nameof(paramNameEquals)} cannot be specified both.");
            }

            if (paramNameEquals != null)
            {
                defaultResponseType.When(apiDesc => apiDesc.ParameterDescriptions.Any(x => x.Source.Id == "Path" && x.Name.Equals(paramNameEquals, StringComparison.OrdinalIgnoreCase)));
            }
            else if (paramNameContains != null)
            {
                defaultResponseType.When(apiDesc => apiDesc.ParameterDescriptions.Any(x => x.Source.Id == "Path" && x.Name.Contains(paramNameEquals, StringComparison.OrdinalIgnoreCase)));
            }
            else
            {
                defaultResponseType.When(apiDesc => apiDesc.ParameterDescriptions.Any(x => x.Source.Id == "Path"));
            }

            return(defaultResponseType);
        }
        /// <summary>
        /// Defines a filter for DefaultResponseType that the api method should equal the provided value in order to be added to the api description.
        /// </summary>
        /// <param name="defaultResponseType">The original default response type</param>
        /// <param name="httpMethod">The HTTP method should equal the provided value.</param>
        /// <returns>The original default response type with an added filter.</returns>
        public static DefaultResponseType ToMethod(this DefaultResponseType defaultResponseType, string httpMethod)
        {
            defaultResponseType.When(apiDesc => apiDesc.HttpMethod.Equals(httpMethod, StringComparison.OrdinalIgnoreCase));

            return(defaultResponseType);
        }